Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update go dependencies and go #562

Merged
merged 4 commits into from
Nov 21, 2023
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: actions/setup-go@v4
id: go
with:
go-version: ^1.19
go-version-file: go.mod

- name: Check out code
uses: actions/checkout@v4
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/security_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

# provide a more modern go until resolved in codeql action
# https://github.com/github/codeql-action/issues/1842#issuecomment-1704398087
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test_acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
uses: actions/setup-go@v4
id: go
with:
go-version: ^1.19
go-version-file: go.mod

- name: Build kubesec
run: |
Expand Down Expand Up @@ -77,6 +77,6 @@ jobs:
echo "REMOTE_URL=localhost:$REMOTE_PORT" >> $GITHUB_ENV
./dist/kubesec http $REMOTE_PORT 2>error.log >output.log &

- name: Run bats acceptance tests
- name: Run bats acceptance tests against built binary
run: |
make test-${{ matrix.test }}
make test-${{ matrix.test }}-built
2 changes: 1 addition & 1 deletion .github/workflows/test_unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: actions/setup-go@v4
id: go
with:
go-version: ^1.19
go-version-file: go.mod

- name: Run go unit tests
run: |
Expand Down
16 changes: 12 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,27 @@ test: ## unit and local acceptance tests
@echo "+ $@"
make test-unit build test-acceptance

# fetch the parent directory of a file we expect to exist
# don't go deeper than the root of the directory
test/bin/%:
git submodule update --init -- $@
git submodule update --init -- $(dirname $@)

.PHONY: bats
bats: test/bin/bats test/bin/bats-assert test/bin/bats-support ## fetch bats dependencies
bats: test/bin/bats/README.md test/bin/bats-assert/README.md test/bin/bats-support/README.md ## fetch bats dependencies

.PHONY: test-acceptance
test-acceptance: bats build ## acceptance tests
test-acceptance: build test-acceptance-built ## acceptance tests

.PHONY: test-acceptance-built
test-acceptance-built: bats ## run acceptance tests with existing kubesec binary
@echo "+ $@"
bash -xc 'cd test && ./bin/bats/bin/bats $(BATS_PARALLEL_JOBS) .'

.PHONY: test-remote
test-remote: bats build ## acceptance tests against remote URL
test-remote: build test-remote-built ## acceptance tests against remote URL

.PHONY: test-remote-built
test-remote-built: bats ## acceptance tests against remote URL with existing kubesec binary
@echo "+ $@"
bash -xc 'cd test && REMOTE_URL=$(REMOTE_URL) ./bin/bats/bin/bats $(BATS_PARALLEL_JOBS) .'

Expand Down
6 changes: 4 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
module github.com/controlplaneio/kubesec/v2

go 1.19
go 1.21

toolchain go1.21.4

require (
github.com/ghodss/yaml v1.0.0
github.com/in-toto/in-toto-golang v0.9.0
github.com/prometheus/client_golang v1.17.0
github.com/spf13/cobra v1.8.0
github.com/thedevsaddam/gojsonq/v2 v2.5.2
github.com/yannh/kubeconform v0.6.3
github.com/yannh/kubeconform v0.6.4
go.uber.org/zap v1.26.0
gopkg.in/yaml.v2 v2.4.0
)
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg=
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down Expand Up @@ -45,6 +46,8 @@ github.com/thedevsaddam/gojsonq/v2 v2.5.2 h1:CoMVaYyKFsVj6TjU6APqAhAvC07hTI6IQen
github.com/thedevsaddam/gojsonq/v2 v2.5.2/go.mod h1:bv6Xa7kWy82uT0LnXPE2SzGqTj33TAEeR560MdJkiXs=
github.com/yannh/kubeconform v0.6.3 h1:lNmb/kphyzitA+GBsOxjBsagCEpjLvt3+qo3XMiEOUA=
github.com/yannh/kubeconform v0.6.3/go.mod h1:4E6oaL+lh7KgCG2SaOabeeAFBkyKu5D9ab0OEekGcbs=
github.com/yannh/kubeconform v0.6.4 h1:P8cQpK+K35qv8JOcjHQcTvD80SwwSDgHfMXyXrZ4rRY=
github.com/yannh/kubeconform v0.6.4/go.mod h1:vl5ZLUE6h0xRd2qB0Drv9cc9sjZnjDYjSaexbfNE9WM=
go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
Expand Down
9 changes: 2 additions & 7 deletions test/2_regression.bats
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@ teardown() {
assert_failure_local
}

@test "returns error YAML control characters" {
run _app "${TEST_DIR}/asset/invalid-input-no-control-characters.json"

assert_invalid_input
}

@test "passes bug dump twice [1/2]" {
run _app "${TEST_DIR}/asset/bug-dump-2.json"
assert_success
Expand All @@ -101,7 +95,8 @@ teardown() {
assert_line "Error: file path is required"
}

@test "errors with invalid file" {
@test "errors with invalid file (local)" {
skip_if_not_local
run _app somefile.yaml
assert_failure_local
assert_file_not_found
Expand Down