From 6944e2d3b891f97a49c9ed271ac57ec513b81d9a Mon Sep 17 00:00:00 2001 From: cpanato Date: Tue, 14 Mar 2023 13:29:35 +0100 Subject: [PATCH 1/4] upgrade to use go1.20 Signed-off-by: cpanato --- .github/workflows/build.yaml | 2 +- .github/workflows/e2e.yaml | 6 +++--- .github/workflows/image.yaml | 2 +- .github/workflows/kind-e2e.yaml | 2 +- .github/workflows/modules-integration-test.yaml | 2 +- .github/workflows/registries.yaml | 6 +++--- .github/workflows/release.yml | 4 ++-- .github/workflows/sbom.yaml | 6 +++--- .github/workflows/style.yaml | 6 +++--- .github/workflows/test.yaml | 2 +- .github/workflows/verify.yaml | 2 +- 11 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a7253f2c08..70242a18cc 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - go-version: ['1.18', '1.19'] + go-version: ['1.19', '1.20'] name: Build ${{ matrix.go-version }} runs-on: ubuntu-latest diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index c07b4b84b3..51f1e52b36 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: '1.20' check-latest: true - name: Build and run ko container @@ -37,11 +37,11 @@ jobs: KO_DOCKER_REPO="" go run ./ build --push=false ./test | grep ":latest@sha256:" KO_DOCKER_REPO="" go run ./ build --push=false -t test ./test | grep ":test@sha256:" KO_DOCKER_REPO="" go run ./ build --push=false -t test --tag-only ./test | grep ":test$" - + # Check that using sbom-dir works. KO_DOCKER_REPO="" go run ./ build -t test --push=false --sbom-dir ./sbom-data ./test jq . ./sbom-data/test.spdx.json - + export PLATFORM=${GOOS}/${GOARCH} if [[ "${{ matrix.platform }}" == "windows-latest" ]]; then diff --git a/.github/workflows/image.yaml b/.github/workflows/image.yaml index ed574939ec..3ad089f59d 100644 --- a/.github/workflows/image.yaml +++ b/.github/workflows/image.yaml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: '1.20' check-latest: true - uses: sigstore/cosign-installer@v3.0.1 diff --git a/.github/workflows/kind-e2e.yaml b/.github/workflows/kind-e2e.yaml index b838d9bee1..c404f9efc5 100644 --- a/.github/workflows/kind-e2e.yaml +++ b/.github/workflows/kind-e2e.yaml @@ -20,7 +20,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: '1.20' check-latest: true - uses: actions/checkout@v3 diff --git a/.github/workflows/modules-integration-test.yaml b/.github/workflows/modules-integration-test.yaml index 785fd705a6..40bd8b4814 100644 --- a/.github/workflows/modules-integration-test.yaml +++ b/.github/workflows/modules-integration-test.yaml @@ -9,7 +9,7 @@ jobs: name: Module Tests strategy: matrix: - go-version: [1.18, 1.19] + go-version: ['1.19', '1.20'] runs-on: 'ubuntu-latest' steps: diff --git a/.github/workflows/registries.yaml b/.github/workflows/registries.yaml index ab0f74770e..8337a59f27 100644 --- a/.github/workflows/registries.yaml +++ b/.github/workflows/registries.yaml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: '1.20' check-latest: true - env: QUAY_USERNAME: ko-testing+test @@ -35,7 +35,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: '1.20' check-latest: true - env: DOCKERHUB_USERNAME: kotesting @@ -65,7 +65,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: '1.20' check-latest: true - name: Install ko diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b8fd1fe312..7f3a294beb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: - run: git fetch --prune --unshallow - uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: '1.20' check-latest: true - uses: goreleaser/goreleaser-action@v4.2.0 id: run-goreleaser @@ -42,7 +42,7 @@ jobs: - run: git fetch --prune --unshallow - uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: '1.20' check-latest: true - uses: imjasonh/setup-ko@v0.6 # This installs the current latest release. - uses: sigstore/cosign-installer@v3.0.1 diff --git a/.github/workflows/sbom.yaml b/.github/workflows/sbom.yaml index f135abb030..1c5f9e8505 100644 --- a/.github/workflows/sbom.yaml +++ b/.github/workflows/sbom.yaml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: '1.20' check-latest: true - uses: chainguard-dev/actions/setup-registry@main - uses: sigstore/cosign-installer@v3.0.1 @@ -50,7 +50,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: '1.20' check-latest: true - uses: chainguard-dev/actions/setup-registry@main - uses: sigstore/cosign-installer@v3.0.1 @@ -82,7 +82,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: '1.20' check-latest: true - uses: chainguard-dev/actions/setup-registry@main - uses: sigstore/cosign-installer@v3.0.1 diff --git a/.github/workflows/style.yaml b/.github/workflows/style.yaml index 318064955b..9a384d7778 100644 --- a/.github/workflows/style.yaml +++ b/.github/workflows/style.yaml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: '1.20' check-latest: true - uses: actions/checkout@v3 - uses: chainguard-dev/actions/gofmt@d886686603afb809f7ef9b734b333e20b7ce5cda @@ -25,7 +25,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: '1.20' check-latest: true - uses: actions/checkout@v3 - uses: chainguard-dev/actions/goimports@d886686603afb809f7ef9b734b333e20b7ce5cda @@ -38,7 +38,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: '1.20' check-latest: true - name: Check out code diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 7bfb420b68..16f142d7ef 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: '1.20' check-latest: true - run: go test -coverprofile=coverage.txt -covermode=atomic -race ./... diff --git a/.github/workflows/verify.yaml b/.github/workflows/verify.yaml index 4ca9867097..ef8bfb1748 100644 --- a/.github/workflows/verify.yaml +++ b/.github/workflows/verify.yaml @@ -11,7 +11,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: '1.20' check-latest: true - uses: actions/checkout@v3 - name: Verify From 28c17bd58beda73df0c0dda4f8dac44cc9ebe8f2 Mon Sep 17 00:00:00 2001 From: cpanato Date: Tue, 14 Mar 2023 13:30:16 +0100 Subject: [PATCH 2/4] bump go module to require minimum go1.19 Signed-off-by: cpanato --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 61375fef39..cf2627e146 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/google/ko -go 1.18 +go 1.19 require ( github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20220517224237-e6f29200ae04 From 93d1731af34beb3f8f842ca19b60422bbacdb7f4 Mon Sep 17 00:00:00 2001 From: cpanato Date: Tue, 14 Mar 2023 13:36:56 +0100 Subject: [PATCH 3/4] fix gofmt Signed-off-by: cpanato --- pkg/build/config.go | 3 +-- pkg/commands/commands.go | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/build/config.go b/pkg/build/config.go index ae5a9a0cbc..f5cb3479f5 100644 --- a/pkg/build/config.go +++ b/pkg/build/config.go @@ -62,8 +62,7 @@ func (a *FlagArray) UnmarshalYAML(unmarshal func(interface{}) error) error { // the original GoReleaser name to match better with the ko naming. // // TODO: Introduce support for more fields where possible and where it makes -/// sense for `ko`, for example ModTimestamp or GoBinary. -// +// / sense for `ko`, for example ModTimestamp or GoBinary. type Config struct { // ID only serves as an identifier internally ID string `yaml:",omitempty"` diff --git a/pkg/commands/commands.go b/pkg/commands/commands.go index b3405e5c89..e141b66092 100644 --- a/pkg/commands/commands.go +++ b/pkg/commands/commands.go @@ -22,7 +22,8 @@ import ( // AddKubeCommands augments our CLI surface with a passthru delete command, and an apply // command that realizes the promise of ko, as outlined here: -// https://github.com/google/go-containerregistry/issues/80 +// +// https://github.com/google/go-containerregistry/issues/80 func AddKubeCommands(topLevel *cobra.Command) { addDelete(topLevel) addVersion(topLevel) From 4af3a1569eb3c9dbd77d6315f45e848a1108e57c Mon Sep 17 00:00:00 2001 From: cpanato Date: Tue, 14 Mar 2023 13:43:51 +0100 Subject: [PATCH 4/4] update base image Signed-off-by: cpanato --- .ko.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ko.yaml b/.ko.yaml index fe71c7d1ca..15685e6144 100644 --- a/.ko.yaml +++ b/.ko.yaml @@ -1,5 +1,5 @@ baseImageOverrides: - github.com/google/ko: golang:1.19 + github.com/google/ko: golang:1.20 builds: - id: ko