From 3278995f3786fb4728afdd637cc8175be2159de2 Mon Sep 17 00:00:00 2001 From: Jan Schoone <6106846+jschoone@users.noreply.github.com> Date: Tue, 10 Sep 2024 11:08:49 +0200 Subject: [PATCH] :sparkles: update images and go version (#203) feat: update images and go version Signed-off-by: Jan Schoone <6106846+jschoone@users.noreply.github.com> --- .builder-image-version.txt | 2 +- .github/actions/setup-go/action.yaml | 1 + .github/renovate/golang.json5 | 2 +- .github/workflows/pr-lint.yaml | 4 ++- .github/workflows/release.yaml | 7 +---- .github/workflows/schedule-scan-image.yaml | 2 +- .gitignore | 2 ++ .golangci.yml | 27 ++++++++++++------- Makefile | 4 +-- ...-k8s.io_openstackclusterstackreleases.yaml | 2 +- ...openstackclusterstackreleasetemplates.yaml | 2 +- ...k.x-k8s.io_openstacknodeimagereleases.yaml | 2 +- docs/quickstart.md | 2 +- go.mod | 7 ++--- images/builder/Dockerfile | 4 +-- images/cspo/Dockerfile | 2 +- 16 files changed, 40 insertions(+), 32 deletions(-) diff --git a/.builder-image-version.txt b/.builder-image-version.txt index d917d3e2..b1e80bb2 100644 --- a/.builder-image-version.txt +++ b/.builder-image-version.txt @@ -1 +1 @@ -0.1.2 +0.1.3 diff --git a/.github/actions/setup-go/action.yaml b/.github/actions/setup-go/action.yaml index 2b590dbe..011e261c 100644 --- a/.github/actions/setup-go/action.yaml +++ b/.github/actions/setup-go/action.yaml @@ -6,6 +6,7 @@ runs: - name: Install go uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 with: + go-version: "1.22" go-version-file: "go.mod" cache: true cache-dependency-path: go.sum diff --git a/.github/renovate/golang.json5 b/.github/renovate/golang.json5 index a47cf951..bc80bd49 100644 --- a/.github/renovate/golang.json5 +++ b/.github/renovate/golang.json5 @@ -4,7 +4,7 @@ }, // https://docs.renovatebot.com/configuration-options/#constraints "constraints": { - "go": "1.21" + "go": "1.22" }, packageRules: [ { diff --git a/.github/workflows/pr-lint.yaml b/.github/workflows/pr-lint.yaml index 1a1a2922..5cc5355b 100644 --- a/.github/workflows/pr-lint.yaml +++ b/.github/workflows/pr-lint.yaml @@ -22,7 +22,7 @@ jobs: if: github.event_name != 'pull_request' || !github.event.pull_request.draft runs-on: ubuntu-latest container: - image: ghcr.io/sovereigncloudstack/cspo-builder:0.1.2 + image: ghcr.io/sovereigncloudstack/cspo-builder:0.1.3 credentials: username: ${{ github.actor }} password: ${{ secrets.github_token }} @@ -32,6 +32,8 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha }} + - uses: ./.github/actions/setup-go + - name: Fixup git permissions # https://github.com/actions/checkout/issues/766 shell: bash diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 59d1fae9..e57d9602 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -75,7 +75,6 @@ jobs: cache-from: type=gha, scope=${{ github.workflow }} cache-to: type=gha, mode=max, scope=${{ github.workflow }} - - name: Sign Container Images run: | cosign sign --yes ghcr.io/sovereigncloudstack/cspo@${{ steps.docker_build_release_cspo.outputs.digest }} @@ -140,11 +139,7 @@ jobs: fetch-depth: 0 - name: Install go - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 - with: - go-version-file: "go.mod" - cache: true - cache-dependency-path: go.sum + uses: ./.github/actions/setup-go - name: install kustomize run: | diff --git a/.github/workflows/schedule-scan-image.yaml b/.github/workflows/schedule-scan-image.yaml index c16113e3..e63bac58 100644 --- a/.github/workflows/schedule-scan-image.yaml +++ b/.github/workflows/schedule-scan-image.yaml @@ -9,7 +9,7 @@ jobs: name: Trivy runs-on: ubuntu-latest container: - image: ghcr.io/sovereigncloudstack/cspo-builder:0.1.2 + image: ghcr.io/sovereigncloudstack/cspo-builder:0.1.3 credentials: username: ${{ github.actor }} password: ${{ secrets.github_token }} diff --git a/.gitignore b/.gitignore index 1c1fe519..8f38f1ea 100644 --- a/.gitignore +++ b/.gitignore @@ -72,3 +72,5 @@ tmp_* .cspotemplate.yaml .secret.yaml .release + +.config diff --git a/.golangci.yml b/.golangci.yml index b10886a2..6d0ecfc3 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -7,12 +7,12 @@ linters: - bodyclose - containedctx - contextcheck + - copyloopvar - durationcheck - errchkjson - errname - errorlint - exhaustive - - exportloopref - forcetypeassert - gci # - goconst @@ -86,10 +86,6 @@ linters-settings: allow-unused: false allow-leading-space: false require-specific: true - staticcheck: - go: "1.21" - stylecheck: - go: "1.21" checks: ["all", "-ST1006"] dot-import-whitelist: - "github.com/onsi/gomega" @@ -101,6 +97,9 @@ linters-settings: - performance - experimental - opinionated + settings: + hugeParam: + sizeThreshold: 120 revive: enable-all-rules: true rules: @@ -141,7 +140,14 @@ linters-settings: severity: warning disabled: false arguments: - - [ "call-chain", "loop", "method-call", "recover", "immediate-recover", "return"] # yamllint disable-line rule:line-length + - [ + "call-chain", + "loop", + "method-call", + "recover", + "immediate-recover", + "return", + ] # yamllint disable-line rule:line-length # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#exported - name: exported severity: warning @@ -224,7 +230,7 @@ linters-settings: - name: struct-tag disabled: true unused: - go: "1.21" + go: "1.22" usestdlibvars: # Suggest the use of http.MethodXX. # Default: true @@ -285,10 +291,11 @@ issues: - linters: - wrapcheck path: _test\.go + exclude-dirs: + - vendor$ + run: timeout: 10m - go: "1.21" + go: "1.22" allow-parallel-runners: true modules-download-mode: vendor - skip-dirs: - - vendor$ diff --git a/Makefile b/Makefile index d12fb23f..9996c32a 100644 --- a/Makefile +++ b/Makefile @@ -89,7 +89,7 @@ export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.28.0 CONTROLLER_GEN := $(abspath $(TOOLS_BIN_DIR)/controller-gen) controller-gen: $(CONTROLLER_GEN) ## Build a local copy of controller-gen $(CONTROLLER_GEN): # Build controller-gen from tools folder. - go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0 + go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.2 KUSTOMIZE := $(abspath $(TOOLS_BIN_DIR)/kustomize) kustomize: $(KUSTOMIZE) ## Build a local copy of kustomize @@ -338,7 +338,7 @@ ifeq ($(BUILD_IN_CONTAINER),true) else go version golangci-lint version - golangci-lint run -v --out-format=github-actions + golangci-lint run -v --out-format=colored-line-number endif .PHONY: lint-yaml diff --git a/config/crd/bases/infrastructure.clusterstack.x-k8s.io_openstackclusterstackreleases.yaml b/config/crd/bases/infrastructure.clusterstack.x-k8s.io_openstackclusterstackreleases.yaml index f47419ec..1462bf93 100644 --- a/config/crd/bases/infrastructure.clusterstack.x-k8s.io_openstackclusterstackreleases.yaml +++ b/config/crd/bases/infrastructure.clusterstack.x-k8s.io_openstackclusterstackreleases.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.2 name: openstackclusterstackreleases.infrastructure.clusterstack.x-k8s.io spec: group: infrastructure.clusterstack.x-k8s.io diff --git a/config/crd/bases/infrastructure.clusterstack.x-k8s.io_openstackclusterstackreleasetemplates.yaml b/config/crd/bases/infrastructure.clusterstack.x-k8s.io_openstackclusterstackreleasetemplates.yaml index 653e2108..5bb22e46 100644 --- a/config/crd/bases/infrastructure.clusterstack.x-k8s.io_openstackclusterstackreleasetemplates.yaml +++ b/config/crd/bases/infrastructure.clusterstack.x-k8s.io_openstackclusterstackreleasetemplates.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.2 name: openstackclusterstackreleasetemplates.infrastructure.clusterstack.x-k8s.io spec: group: infrastructure.clusterstack.x-k8s.io diff --git a/config/crd/bases/infrastructure.clusterstack.x-k8s.io_openstacknodeimagereleases.yaml b/config/crd/bases/infrastructure.clusterstack.x-k8s.io_openstacknodeimagereleases.yaml index d341dd72..e7e24989 100644 --- a/config/crd/bases/infrastructure.clusterstack.x-k8s.io_openstacknodeimagereleases.yaml +++ b/config/crd/bases/infrastructure.clusterstack.x-k8s.io_openstacknodeimagereleases.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.2 name: openstacknodeimagereleases.infrastructure.clusterstack.x-k8s.io spec: group: infrastructure.clusterstack.x-k8s.io diff --git a/docs/quickstart.md b/docs/quickstart.md index a7ccb276..56e52215 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -2,4 +2,4 @@ This document has been moved. -You can find the current version of the quickstart guide [here](https://github.com/SovereignCloudStack/cluster-stacks/blob/main/providers/openstack/README.md). +You can find the current version of the quickstart guide [here](https://docs.scs.community/docs/container/components/cluster-stacks/components/cluster-stack-provider-openstack/docs/quickstart). diff --git a/go.mod b/go.mod index 9c8e5bd8..825a2619 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,11 @@ module github.com/SovereignCloudStack/cluster-stack-provider-openstack -go 1.21.6 +go 1.22 -toolchain go1.22.1 +toolchain go1.23.0 require ( github.com/SovereignCloudStack/cluster-stack-operator v0.1.0-alpha.5 - github.com/google/go-github/v52 v52.0.0 github.com/gophercloud/gophercloud/v2 v2.0.0-beta.2 github.com/gophercloud/utils/v2 v2.0.0-20240305212012-b57aefba4cdb github.com/onsi/ginkgo/v2 v2.17.1 @@ -22,6 +21,8 @@ require ( sigs.k8s.io/yaml v1.4.0 ) +require github.com/google/go-github/v52 v52.0.0 + require ( github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect github.com/beorn7/perks v1.0.1 // indirect diff --git a/images/builder/Dockerfile b/images/builder/Dockerfile index ce39a1ca..fc6a1325 100644 --- a/images/builder/Dockerfile +++ b/images/builder/Dockerfile @@ -30,7 +30,7 @@ ENV GOLANGCI_VERSION="v1.59.1" # update: datasource=github-tags depName=kubernetes-sigs/kind ENV KIND_VERSION="v0.23.0" # update: datasource=github-tags depName=kubernetes/kubernetes -ARG KUBECTL_VERSION="v1.27.3" +ARG KUBECTL_VERSION="v1.31.0" # update: datasource=github-tags depName=kubernetes-sigs/kustomize extractVersion=^kustomize\/v(?.+)$ ENV KUSTOMIZE_VERSION="v5.3.0" # update: datasource=github-tags depName=aquasecurity/trivy @@ -54,7 +54,7 @@ RUN curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/in ############################ # CSPO Build Image Base # ############################ -FROM docker.io/library/golang:1.21.8-bullseye +FROM docker.io/library/golang:1.23.0-bullseye # update: datasource=github-tags depName=adrienverge/yamllint versioning=semver ENV YAMLLINT_VERSION="v1.35.1" diff --git a/images/cspo/Dockerfile b/images/cspo/Dockerfile index 993a4b90..783e952f 100644 --- a/images/cspo/Dockerfile +++ b/images/cspo/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. # Build the manager binary -FROM --platform=${BUILDPLATFORM} docker.io/library/golang:1.21.8-bullseye as build +FROM --platform=${BUILDPLATFORM} docker.io/library/golang:1.23.0-bullseye as build ARG TARGETOS TARGETARCH COPY . /src/cluster-stack-provider-openstack