From 79ca3ceec11ad1e385cc966740faa1a185d4c2d3 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Wed, 28 Sep 2022 18:34:56 +0300 Subject: [PATCH] Build with Go 1.19 - Update Go to 1.19 in CI - Use Go 1.19 in base image - Update Alpine to 3.16 in the final image - Update controller-gen v0.8.0 (v0.7 fails with Go 1.19) and regenerate manifests Signed-off-by: Stefan Prodan --- .github/workflows/build.yaml | 6 +-- .github/workflows/cifuzz.yaml | 2 +- .github/workflows/scan.yml | 4 ++ Dockerfile | 4 +- Makefile | 2 +- ...lkit.fluxcd.io_imageupdateautomations.yaml | 39 ++++++++----------- controllers/controllers_fuzzer_test.go | 3 +- pkg/test/files.go | 2 +- 8 files changed, 30 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b4fded3..6e7ed5d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -17,7 +17,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - name: Restore go cache uses: actions/cache@v3 with: @@ -41,7 +41,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - name: Run tests run: make test env: @@ -64,7 +64,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - name: Restore Go cache uses: actions/cache@v3 with: diff --git a/.github/workflows/cifuzz.yaml b/.github/workflows/cifuzz.yaml index e63e3cd..47d2638 100644 --- a/.github/workflows/cifuzz.yaml +++ b/.github/workflows/cifuzz.yaml @@ -16,7 +16,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - name: Restore Go cache uses: actions/cache@v3 with: diff --git a/.github/workflows/scan.yml b/.github/workflows/scan.yml index 9cdb875..9e122bd 100644 --- a/.github/workflows/scan.yml +++ b/.github/workflows/scan.yml @@ -31,6 +31,10 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.19.x - name: Initialize CodeQL uses: github/codeql-action/init@v2 with: diff --git a/Dockerfile b/Dockerfile index b2d4783..fd1482c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ ARG BASE_VARIANT=alpine -ARG GO_VERSION=1.18 +ARG GO_VERSION=1.19 ARG XX_VERSION=1.1.2 ARG LIBGIT2_IMG=ghcr.io/fluxcd/golang-with-libgit2-only @@ -72,7 +72,7 @@ RUN export LIBRARY_PATH="/usr/local/$(xx-info triple)" && \ # Ensure that the binary was cross-compiled correctly to the target platform. RUN xx-verify --static /image-automation-controller -FROM alpine:3.15 +FROM alpine:3.16 ARG TARGETPLATFORM RUN apk --no-cache add ca-certificates \ diff --git a/Makefile b/Makefile index 18f4927..4b78180 100644 --- a/Makefile +++ b/Makefile @@ -195,7 +195,7 @@ docker-deploy: ## Set the Docker image in-cluster CONTROLLER_GEN = $(GOBIN)/controller-gen .PHONY: controller-gen controller-gen: ## Download controller-gen locally if necessary. - $(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0) + $(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.8.0) libgit2: $(LIBGIT2) ## Detect or download libgit2 library diff --git a/config/crd/bases/image.toolkit.fluxcd.io_imageupdateautomations.yaml b/config/crd/bases/image.toolkit.fluxcd.io_imageupdateautomations.yaml index 34f0aa4..dfa82ec 100644 --- a/config/crd/bases/image.toolkit.fluxcd.io_imageupdateautomations.yaml +++ b/config/crd/bases/image.toolkit.fluxcd.io_imageupdateautomations.yaml @@ -1,10 +1,9 @@ - --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.7.0 + controller-gen.kubebuilder.io/version: v0.8.0 creationTimestamp: null name: imageupdateautomations.image.toolkit.fluxcd.io spec: @@ -156,14 +155,12 @@ spec: description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct is intended for direct use as an array at the field path .status.conditions. For example, - \n \ttype FooStatus struct{ \t // Represents the observations - of a foo's current state. \t // Known .status.conditions.type - are: \"Available\", \"Progressing\", and \"Degraded\" \t // - +patchMergeKey=type \t // +patchStrategy=merge \t // +listType=map - \t // +listMapKey=type \t Conditions []metav1.Condition + \n type FooStatus struct{ // Represents the observations of a + foo's current state. // Known .status.conditions.type are: \"Available\", + \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge + // +listType=map // +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" - protobuf:\"bytes,1,rep,name=conditions\"` \n \t // other fields - \t}" + protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }" properties: lastTransitionTime: description: lastTransitionTime is the last time the condition @@ -429,14 +426,12 @@ spec: description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct is intended for direct use as an array at the field path .status.conditions. For example, - \n \ttype FooStatus struct{ \t // Represents the observations - of a foo's current state. \t // Known .status.conditions.type - are: \"Available\", \"Progressing\", and \"Degraded\" \t // - +patchMergeKey=type \t // +patchStrategy=merge \t // +listType=map - \t // +listMapKey=type \t Conditions []metav1.Condition + \n type FooStatus struct{ // Represents the observations of a + foo's current state. // Known .status.conditions.type are: \"Available\", + \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge + // +listType=map // +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" - protobuf:\"bytes,1,rep,name=conditions\"` \n \t // other fields - \t}" + protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }" properties: lastTransitionTime: description: lastTransitionTime is the last time the condition @@ -714,14 +709,12 @@ spec: description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct is intended for direct use as an array at the field path .status.conditions. For example, - \n \ttype FooStatus struct{ \t // Represents the observations - of a foo's current state. \t // Known .status.conditions.type - are: \"Available\", \"Progressing\", and \"Degraded\" \t // - +patchMergeKey=type \t // +patchStrategy=merge \t // +listType=map - \t // +listMapKey=type \t Conditions []metav1.Condition + \n type FooStatus struct{ // Represents the observations of a + foo's current state. // Known .status.conditions.type are: \"Available\", + \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge + // +listType=map // +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" - protobuf:\"bytes,1,rep,name=conditions\"` \n \t // other fields - \t}" + protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }" properties: lastTransitionTime: description: lastTransitionTime is the last time the condition diff --git a/controllers/controllers_fuzzer_test.go b/controllers/controllers_fuzzer_test.go index 88abf26..635f653 100644 --- a/controllers/controllers_fuzzer_test.go +++ b/controllers/controllers_fuzzer_test.go @@ -77,7 +77,8 @@ var testFiles embed.FS // This fuzzer randomized 2 things: // 1: The files in the git repository // 2: The values of ImageUpdateAutomationSpec -// and ImagePolicy resources +// +// and ImagePolicy resources func Fuzz_ImageUpdateReconciler(f *testing.F) { f.Fuzz(func(t *testing.T, seed []byte) { initter.Do(func() { diff --git a/pkg/test/files.go b/pkg/test/files.go index 891f4b6..a903d42 100644 --- a/pkg/test/files.go +++ b/pkg/test/files.go @@ -76,7 +76,7 @@ func (d dirfile) FailedExpectation(g *WithT) { // DiffDirectories walks the two given directories, recursively, and // reports relative paths for any files that are: // -// (in actual but not expected, in expected but not actual, in both but different) +// (in actual but not expected, in expected but not actual, in both but different) // // It ignores dot directories (e.g., `.git/`) and Emacs backups (e.g., // `foo.yaml~`). It panics if it encounters any error apart from a