Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/edge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ on:
- main

env:
GO_VERSION: "1.16"
GO_VERSION: "1.22"
DOCKER_REGISTRY: "ghcr.io"

jobs:
edge:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Login to GitHub Packages Docker Registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.repository_owner }}
Expand All @@ -33,4 +33,4 @@ jobs:
- name: Build and Push docker image
run: |
DOCKER_TAG=edge make docker
docker push ${{ env.DOCKER_REGISTRY }}/goodwaygroup/gwsm:edge
docker push ${{ env.DOCKER_REGISTRY }}/goodwaygroup/gwsm:edge
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: lint
on: [ push, pull_request ]
on: [push, pull_request]
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v6
with:
version: v1.38
version: v1.62
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,35 @@ name: goreleaser
on:
push:
tags:
- '*'
- "*"

env:
GO_VERSION: "1.16"
DOCKER_REGISTRY: "ghcr.io"

jobs:
goreleaser:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Login to GitHub Packages Docker Registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --rm-dist
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@ build/
.DS_Store
bin/
dist/
gwsm
gwsm

temp/
tmp/
45 changes: 43 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ run:
timeout: 2m

output:
format: tab
formats:
- format: tab

issues:
max-issues-per-linter: 0
Expand All @@ -16,6 +17,46 @@ linters:
- gocritic
- gocyclo
- gofmt
- golint
- misspell
- unconvert

linters-settings:
depguard:
rules:
main:
files:
- $all
allow:
- $gostd # Allow all Go standard library imports
- github.com/a8m/djson
- github.com/AlecAivazis/survey/v2
- github.com/aws/aws-sdk-go-v2/aws
- github.com/aws/aws-sdk-go-v2/config
- github.com/aws/aws-sdk-go-v2/feature/s3/manager
- github.com/aws/aws-sdk-go-v2/service/s3
- github.com/aws/aws-sdk-go-v2/service/secretsmanager
- github.com/aws/aws-sdk-go-v2/service/secretsmanager/types
- github.com/clok/avtool/v3
- github.com/clok/cdocs
- github.com/clok/kemba
- github.com/cyberark/summon/pkg/secretsyml
- github.com/GoodwayGroup/gwsm/cmd
- github.com/GoodwayGroup/gwsm/env
- github.com/GoodwayGroup/gwsm/info
- github.com/GoodwayGroup/gwsm/kube
- github.com/GoodwayGroup/gwsm/s3
- github.com/GoodwayGroup/gwsm/sm
- github.com/jedib0t/go-pretty/v6/table
- github.com/logrusorgru/aurora/v3
- github.com/manifoldco/promptui
- github.com/r3labs/diff/v2
- github.com/sergi/go-diff/diffmatchpatch
- github.com/TylerBrock/colorjson
- github.com/urfave/cli/v2
- k8s.io/api/core/v1
- k8s.io/apimachinery/pkg/apis/meta/v1
- k8s.io/client-go/kubernetes
- k8s.io/client-go/kubernetes/scheme
- k8s.io/client-go/rest
- k8s.io/client-go/tools/clientcmd
- k8s.io/client-go/tools/remotecommand
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ Each command ans subcommand has detailed help text that can be viewed using the

## Built With

* go v1.16
* make
* [git-chglog](https://github.com/git-chglog/git-chglog)
* [goreleaser](https://goreleaser.com/install/)
- go v1.22
- make
- [git-chglog](https://github.com/git-chglog/git-chglog)
- [goreleaser](https://goreleaser.com/install/)

## Deployment

Expand All @@ -122,7 +122,7 @@ requests to us.
1. Use `go >= 1.16`
1. Branch & Code
1. Run linters :broom: `golangci-lint run`
- The project uses [golangci-lint](https://golangci-lint.run/usage/install/#local-installation)
- The project uses [golangci-lint](https://golangci-lint.run/welcome/install/#brew)
1. Commit with a Conventional Commit
1. Open a PR

Expand All @@ -133,7 +133,7 @@ versions available, see the [tags on this repository](https://github.com/Goodway

## Authors

* **Derek Smith** - [@clok](https://github.com/clok)
- **Derek Smith** - [@clok](https://github.com/clok)

See also the list of [contributors](https://github.com/GoodwayGroup/gwvault/contributors) who participated in this
project.
Expand Down
7 changes: 4 additions & 3 deletions cmd/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ package cmd
import (
"bytes"
"fmt"
"os"
"sort"
"strings"

"github.com/GoodwayGroup/gwsm/env"
"github.com/clok/kemba"
"github.com/jedib0t/go-pretty/v6/table"
"github.com/logrusorgru/aurora/v3"
"github.com/r3labs/diff/v2"
"github.com/sergi/go-diff/diffmatchpatch"
"github.com/urfave/cli/v2"
"os"
"sort"
"strings"
)

var (
Expand Down
9 changes: 5 additions & 4 deletions cmd/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package cmd

import (
"fmt"
"os"
"sort"
"strings"

"github.com/GoodwayGroup/gwsm/env"
"github.com/clok/kemba"
"github.com/jedib0t/go-pretty/v6/table"
"github.com/urfave/cli/v2"
"os"
"sort"
"strings"
)

// Print the resulting environment for a set of local ConfigMap and Summon secrets.yml file.
Expand All @@ -26,7 +27,7 @@ func ViewLocalEnv(c *cli.Context) error {
t.SetTitle("From ConfigMap")
} else {
l := kemba.PickColor(group)
t.SetTitle(fmt.Sprintf("From secret: %s", l.Sprintf(group)))
t.SetTitle(fmt.Sprintf("From secret: %s", l.Sprint(group)))
}
t.AppendHeader(table.Row{"Key", "Value"})

Expand Down
11 changes: 6 additions & 5 deletions cmd/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package cmd

import (
"fmt"
"github.com/logrusorgru/aurora/v3"
"io/ioutil"
"io"
"os"
"testing"

"github.com/logrusorgru/aurora/v3"
)

func Test_PrintWarn(t *testing.T) {
Expand All @@ -16,7 +17,7 @@ func Test_PrintWarn(t *testing.T) {
PrintWarn("This is a test!")

w.Close()
out, _ := ioutil.ReadAll(r)
out, _ := io.ReadAll(r)
os.Stderr = rescueStderr

wantMsg := fmt.Sprintln(aurora.Red("✖ This is a test!"))
Expand All @@ -33,7 +34,7 @@ func Test_PrintSuccess(t *testing.T) {
PrintSuccess("This is a test!")

w.Close()
out, _ := ioutil.ReadAll(r)
out, _ := io.ReadAll(r)
os.Stderr = rescueStderr

wantMsg := fmt.Sprintln(aurora.Green("✔ This is a test!"))
Expand All @@ -50,7 +51,7 @@ func Test_PrintInfo(t *testing.T) {
PrintInfo("This is a test!")

w.Close()
out, _ := ioutil.ReadAll(r)
out, _ := io.ReadAll(r)
os.Stderr = rescueStderr

wantMsg := fmt.Sprintln(aurora.Gray(14, "➜ This is a test!"))
Expand Down
38 changes: 22 additions & 16 deletions cmd/sm.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ package cmd
import (
"encoding/json"
"fmt"
"os"
"sort"
"strings"

"github.com/AlecAivazis/survey/v2"
"github.com/GoodwayGroup/gwsm/sm"
"github.com/TylerBrock/colorjson"
"github.com/a8m/djson"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/jedib0t/go-pretty/v6/table"
"github.com/urfave/cli/v2"
"os"
"sort"
"strings"
)

// truncateString limits the length of a string while also appending an ellipses.
Expand Down Expand Up @@ -41,7 +42,7 @@ func selectSecretNameFromList(c *cli.Context) (string, error) {

secretNames := make([]string, 0, len(secrets))
for _, secret := range secrets {
secretNames = append(secretNames, aws.StringValue(secret.Name))
secretNames = append(secretNames, aws.ToString(secret.Name))
}
sort.Strings(secretNames)

Expand Down Expand Up @@ -155,13 +156,13 @@ func ListSecrets(c *cli.Context) error {
})

for _, secret := range secrets {
lastdt := aws.TimeValue(secret.LastAccessedDate)
updateddt := aws.TimeValue(secret.LastChangedDate)
lastdt := aws.ToTime(secret.LastAccessedDate)
updateddt := aws.ToTime(secret.LastChangedDate)
t.AppendRow([]interface{}{
aws.StringValue(secret.Name),
aws.ToString(secret.Name),
fmt.Sprintf("%d-%02d-%02d", updateddt.Year(), updateddt.Month(), updateddt.Day()),
fmt.Sprintf("%d-%02d-%02d", lastdt.Year(), lastdt.Month(), lastdt.Day()),
truncateString(aws.StringValue(secret.Description), 40),
truncateString(aws.ToString(secret.Description), 40),
})
}

Expand All @@ -185,10 +186,10 @@ func ViewSecret(c *cli.Context) error {
if c.Bool("binary") {
fmt.Println(string(secret.SecretBinary))
} else {
result, err := djson.Decode([]byte(aws.StringValue(secret.SecretString)))
result, err := djson.Decode([]byte(aws.ToString(secret.SecretString)))
if err != nil {
PrintWarn("stored string value is not valid JSON.")
fmt.Println(aws.StringValue(secret.SecretString))
fmt.Println(aws.ToString(secret.SecretString))
} else {
f := colorjson.NewFormatter()
f.Indent = 4
Expand All @@ -213,7 +214,12 @@ func DescribeSecret(c *cli.Context) error {
return cli.Exit(err, 2)
}

fmt.Println(secret.String())
jString, err := json.MarshalIndent(secret, "", " ")
if err != nil {
return cli.Exit(err, 2)
}

fmt.Println(string(jString))

return nil
}
Expand All @@ -234,10 +240,10 @@ func EditSecret(c *cli.Context) error {
if c.Bool("binary") {
s = secret.SecretBinary
} else {
result, err := djson.Decode([]byte(aws.StringValue(secret.SecretString)))
result, err := djson.Decode([]byte(aws.ToString(secret.SecretString)))
if err != nil {
PrintWarn("stored string value is not valid JSON.")
s = []byte(aws.StringValue(secret.SecretString))
s = []byte(aws.ToString(secret.SecretString))
} else {
s, err = json.MarshalIndent(result, "", " ")
if err != nil {
Expand Down Expand Up @@ -369,10 +375,10 @@ func PutSecret(c *cli.Context) error {
if c.Bool("binary") {
value = secret.SecretBinary
} else {
result, err := djson.Decode([]byte(aws.StringValue(secret.SecretString)))
result, err := djson.Decode([]byte(aws.ToString(secret.SecretString)))
if err != nil {
PrintWarn("stored string value is not valid JSON.")
value = []byte(aws.StringValue(secret.SecretString))
value = []byte(aws.ToString(secret.SecretString))
} else {
value, err = json.MarshalIndent(result, "", " ")
if err != nil {
Expand Down
Loading