Skip to content

Commit

Permalink
fix(tests): fix testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Morelly authored and FalcoSuessgott committed Dec 29, 2023
1 parent 45ba50d commit 1b92709
Show file tree
Hide file tree
Showing 12 changed files with 205 additions and 109 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:

steps:
- uses: actions/checkout@v4

- run: go generate -tags tools tools/tools.go

- uses: actions/setup-go@v5
with:
Expand All @@ -19,10 +21,13 @@ jobs:
run: go get ./...

- name: Run coverage
run: go test -v -race -coverprofile="coverage.out" -covermode=atomic ./...
run: |
gotestsum -- -v -race -coverprofile="coverage.out" -covermode=atomic ./...
env:
VAULT_VERSION: latest
VAULT_LICENSE: ${{ secrets.VAULT_LICENSE }}
# https://github.com/testcontainers/testcontainers-go/issues/1782
TESTCONTAINERS_RYUK_DISABLED: true

- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest'
Expand Down
23 changes: 4 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,7 @@ assets: clean vault-ent ## generate all assets
vhs < assets/tapes/$$i.tape; \
done

.PHONY: www
www: ## build and server docs
hugo server -s www

.PHONY: docker/build
docker/build: ## build docker images
docker build \
--pull \
--no-cache \
-t vkv:latest \
.

.PHONY: docker/run
docker/run: ## run docker image
@docker run \
--network=host \
-e VAULT_ADDR=${VAULT_ADDR} \
-e VAULT_TOKEN=${VAULT_TOKEN} \
vkv export -p secret
.PHONY: docs
docs: ## build and serve docs
mkdocs serve

5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
<img src="https://img.shields.io/github/downloads/FalcoSuessgott/vkv/total.svg" alt="drawing"/>
<img src="https://img.shields.io/github/v/release/FalcoSuessgott/vkv" alt="drawing"/>

`vkv` is a little CLI tool written in Go, which enables you to list, compare, import, document, backup & encrypt secrets from a [HashiCorp Vault KV-v2 engine](https://developer.hashicorp.com/vault/docs/secrets/kv/kv-v2):
`vkv` is a little CLI tool written in Go, which enables you to list, compare, import, document, backup & encrypt secrets from a [HashiCorp Vault KV engine](https://developer.hashicorp.com/vault/docs/secrets/kv):

<img src="docs/assets/demo.gif" alt="drawing"/>
</div>

## Features
* Support KV version 1 & version 2 (no need to specify the version `vkv` will automatically detect the engines version)
* **CI/CD Integrations for [Gitlab, GitHub, Azure Devops](https://falcosuessgott.github.io/vkv/cicd/gitlab/)**
* support all Vault Auth Env Vars and `VKV_LOGIN_COMMAND` for avoiding having to hardcode the `VAULT_TOKEN` ([example](https://falcosuessgott.github.io/vkv/authentication/))
* recursively print secrets of any KVv2 Engine in `json`, `yaml`, `markdown` and [other formats](https://falcosuessgott.github.io/vkv/export/formats/)
* recursively print secrets of any KV Engine in `json`, `yaml`, `markdown` and [other formats](https://falcosuessgott.github.io/vkv/export/formats/)
* engine export shows the secret version as well as its [custom metadata](https://developer.hashicorp.com/vault/docs/commands/kv/metadata)
* customize the output (show only-keys, only-paths, mask/unmask secrets) via [flags or environment](https://falcosuessgott.github.io/vkv/export/)
* print the CRUD-capabilities of the authenticated token for each KV-path (format: `policy`)
Expand Down
5 changes: 3 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
![gif](assets/demo.gif)


`vkv` is a little CLI tool written in Go, which enables you to list, compare, import, document, backup & encrypt secrets from a [HashiCorp Vault KV-v2 engine](https://developer.hashicorp.com/vault/docs/secrets/kv/kv-v2):
`vkv` is a little CLI tool written in Go, which enables you to list, compare, import, document, backup & encrypt secrets from a [HashiCorp Vault KV engine](https://developer.hashicorp.com/vault/docs/secrets/kv):


## Features
* Support KV version 1 & version 2 (no need to specify the version `vkv` will automatically detect the engines version)
* **CI/CD Integrations for [Gitlab, GitHub, Azure Devops](https://falcosuessgott.github.io/vkv/cicd/gitlab/)**
* support all Vault Auth Env Vars and `VKV_LOGIN_COMMAND` for avoiding having to hardcode the `VAULT_TOKEN` ([example](https://falcosuessgott.github.io/vkv/authentication/))
* recursively print secrets of any KVv2 Engine in `json`, `yaml`, `markdown` and [other formats](https://falcosuessgott.github.io/vkv/export/formats/)
* recursively print secrets of any KV Engine in `json`, `yaml`, `markdown` and [other formats](https://falcosuessgott.github.io/vkv/export/formats/)
* engine export shows the secret version as well as its [custom metadata](https://developer.hashicorp.com/vault/docs/commands/kv/metadata)
* customize the output (show only-keys, only-paths, mask/unmask secrets) via [flags or environment](https://falcosuessgott.github.io/vkv/export/)
* print the CRUD-capabilities of the authenticated token for each KV-path (format: `policy`)
Expand Down
5 changes: 3 additions & 2 deletions docs/installation/index.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
### cURL
```bash
curl -OL https://github.com/FalcoSuessgott/vkv/releases/download/v0.3.0/vkv_$(uname)_$(uname -m).tar.gz
// latest version: https://github.com/FalcoSuessgott/vkv/releases
curl -OL https://github.com/FalcoSuessgott/vkv/releases/download/v0.5.0/vkv_$(uname)_$(uname -m).tar.gz
tar xzf vkv_$(uname)_$(uname -m).tar.gz
chmod u+x vkv
./vkv version
vkv 0.3.0
vkv 0.5.0
```

### Packages
Expand Down
48 changes: 27 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ require (
github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/Microsoft/hcsshim v0.11.1 // indirect
github.com/Microsoft/hcsshim v0.11.4 // indirect
github.com/OpenPeeDeeP/depguard/v2 v2.1.0 // indirect
github.com/alecthomas/go-check-sumtype v0.1.3 // indirect
github.com/alexkohler/nakedret/v2 v2.0.2 // indirect
Expand All @@ -40,6 +40,7 @@ require (
github.com/ashanbrown/forbidigo v1.6.0 // indirect
github.com/ashanbrown/makezero v1.1.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bitfield/gotestdox v0.2.1 // indirect
github.com/bkielbasa/cyclop v1.2.1 // indirect
github.com/blizzy78/varnamelen v0.8.0 // indirect
github.com/bombsimon/wsl/v3 v3.4.0 // indirect
Expand All @@ -56,13 +57,15 @@ require (
github.com/chavacava/garif v0.1.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/chenzhuoyu/iasm v0.9.1 // indirect
github.com/containerd/containerd v1.7.7 // indirect
github.com/containerd/containerd v1.7.11 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/cpuguy83/dockercfg v0.3.1 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/curioswitch/go-reassign v0.2.0 // indirect
github.com/denis-tingaikin/go-header v0.4.3 // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/distribution/reference v0.5.0 // indirect
github.com/dnephin/pflag v1.0.7 // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/esimonov/ifshort v1.0.4 // indirect
Expand Down Expand Up @@ -104,7 +107,8 @@ require (
github.com/golangci/revgrep v0.5.2 // indirect
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.5.0 // indirect
github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 // indirect
github.com/gostaticanalysis/analysisutil v0.7.1 // indirect
github.com/gostaticanalysis/comment v1.4.2 // indirect
Expand All @@ -128,7 +132,7 @@ require (
github.com/kisielk/errcheck v1.6.3 // indirect
github.com/kisielk/gotool v1.0.0 // indirect
github.com/kkHAIKE/contextcheck v1.1.4 // indirect
github.com/klauspost/compress v1.17.0 // indirect
github.com/klauspost/compress v1.17.4 // indirect
github.com/klauspost/cpuid/v2 v2.2.6 // indirect
github.com/kulti/thelper v0.6.3 // indirect
github.com/kunwardeep/paralleltest v1.0.8 // indirect
Expand All @@ -138,7 +142,7 @@ require (
github.com/leodido/go-urn v1.2.4 // indirect
github.com/leonklingele/grouper v1.1.1 // indirect
github.com/lufeee/execinquery v1.2.1 // indirect
github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a // indirect
github.com/lufia/plan9stats v0.0.0-20231016141302-07b5767bb0ed // indirect
github.com/lunixbochs/vtclean v1.0.0 // indirect
github.com/macabu/inamedparam v0.1.2 // indirect
github.com/magiconair/properties v1.8.7 // indirect
Expand Down Expand Up @@ -190,7 +194,7 @@ require (
github.com/sashamelentyev/usestdlibvars v1.24.0 // indirect
github.com/securego/gosec/v2 v2.18.2 // indirect
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect
github.com/shirou/gopsutil/v3 v3.23.9 // indirect
github.com/shirou/gopsutil/v3 v3.23.11 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sivchari/containedctx v1.0.3 // indirect
Expand All @@ -212,8 +216,8 @@ require (
github.com/tetafro/godot v1.4.15 // indirect
github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 // indirect
github.com/timonwong/loggercheck v0.9.4 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/tklauser/go-sysconf v0.3.13 // indirect
github.com/tklauser/numcpus v0.7.0 // indirect
github.com/tomarrell/wrapcheck/v2 v2.8.1 // indirect
github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
Expand All @@ -232,18 +236,20 @@ require (
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/goleak v1.1.12 // indirect
golang.org/x/arch v0.6.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/exp v0.0.0-20231226003508-02704c960a9b // indirect
golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/sync v0.4.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.14.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect
google.golang.org/grpc v1.58.2 // indirect
golang.org/x/tools v0.16.1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 // indirect
google.golang.org/grpc v1.60.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools/gotestsum v1.11.0 // indirect
honnef.co/go/tools v0.4.6 // indirect
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect
Expand All @@ -253,16 +259,16 @@ require (
require (
github.com/daixiang0/gci v0.11.2
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/docker/docker v24.0.6+incompatible // indirect
github.com/docker/docker v24.0.7+incompatible
github.com/go-test/deep v1.1.0 // indirect
github.com/golangci/golangci-lint v1.55.1
github.com/hashicorp/hcl v1.0.1-vault-5 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/opencontainers/runc v1.1.9 // indirect
github.com/opencontainers/runc v1.1.10 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
go.uber.org/multierr v1.7.0 // indirect
go.uber.org/zap v1.24.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect
mvdan.cc/gofumpt v0.5.0
)

Expand All @@ -272,7 +278,7 @@ require (
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-retryablehttp v0.7.4 // indirect
github.com/olekukonko/tablewriter v0.0.5
golang.org/x/crypto v0.15.0 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/crypto v0.16.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/time v0.3.0 // indirect
)
Loading

0 comments on commit 1b92709

Please sign in to comment.