From 9256979fe4baab41e6b18414262018cdbf69f7b5 Mon Sep 17 00:00:00 2001 From: Yoni Bettan Date: Thu, 2 Jan 2025 17:30:59 +0200 Subject: [PATCH] Bumping to `go1.23`. (#1285) Signed-off-by: Yoni Bettan --- Dockerfile | 4 ++-- Dockerfile.kmm-operator-build | 2 +- Dockerfile.webhook | 4 ++-- Dockerfile.worker | 4 ++-- Makefile | 2 +- ci/prow/lint | 4 +--- go.mod | 4 ++-- internal/controllers/nmc_reconciler_test.go | 8 ++++---- 8 files changed, 15 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 57a3ccc1b..20bcc18b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM registry.access.redhat.com/ubi9/go-toolset:1.21 as builder +FROM golang:1.23 as builder # Copy the Go Modules manifests COPY go.mod go.mod @@ -31,7 +31,7 @@ FROM registry.access.redhat.com/ubi9/ubi-minimal:9.4 ARG TARGET -COPY --from=builder /opt/app-root/src/${TARGET} /usr/local/bin/manager +COPY --from=builder /go/${TARGET} /usr/local/bin/manager RUN microdnf update -y && \ microdnf install -y shadow-utils && \ diff --git a/Dockerfile.kmm-operator-build b/Dockerfile.kmm-operator-build index 26e198fa6..93acebbeb 100644 --- a/Dockerfile.kmm-operator-build +++ b/Dockerfile.kmm-operator-build @@ -1,4 +1,4 @@ -FROM golang:1.21-alpine3.19 +FROM golang:1.23-alpine3.21 ENV GO111MODULE=on ENV GOFLAGS="" diff --git a/Dockerfile.webhook b/Dockerfile.webhook index 57b06e7cf..6a8f80e23 100644 --- a/Dockerfile.webhook +++ b/Dockerfile.webhook @@ -1,5 +1,5 @@ # Build the manager binary -FROM registry.access.redhat.com/ubi9/go-toolset:1.21 as builder +FROM golang:1.23 as builder # Copy the Go Modules manifests COPY go.mod go.mod @@ -27,6 +27,6 @@ RUN make webhook-server FROM registry.access.redhat.com/ubi9/ubi-minimal:9.4 -COPY --from=builder /opt/app-root/src/webhook-server /usr/local/bin/webhook-server +COPY --from=builder /go/webhook-server /usr/local/bin/webhook-server ENTRYPOINT ["/usr/local/bin/webhook-server"] diff --git a/Dockerfile.worker b/Dockerfile.worker index 07d190947..701df4ec8 100644 --- a/Dockerfile.worker +++ b/Dockerfile.worker @@ -1,5 +1,5 @@ # Build the manager binary -FROM registry.access.redhat.com/ubi9/go-toolset:1.21 as builder +FROM golang:1.23 as builder # Add the vendored dependencies COPY vendor vendor @@ -30,7 +30,7 @@ RUN microdnf update -y && \ microdnf install -y kmod shadow-utils && \ microdnf clean all -COPY --from=builder /opt/app-root/src/worker /usr/local/bin/worker +COPY --from=builder /go/worker /usr/local/bin/worker RUN ["groupadd", "--system", "-g", "201", "kmm"] RUN ["useradd", "--system", "-u", "201", "-g", "201", "-s", "/sbin/nologin", "kmm"] diff --git a/Makefile b/Makefile index 1cab45cf1..4af82eb15 100644 --- a/Makefile +++ b/Makefile @@ -243,7 +243,7 @@ controller-gen: ## Download controller-gen locally if necessary. GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint .PHONY: golangci-lint golangci-lint: ## Download golangci-lint locally if necessary. - $(call go-get-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.1) + $(call go-get-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.2) .PHONY: mockgen mockgen: ## Install mockgen locally. diff --git a/ci/prow/lint b/ci/prow/lint index f78f04d93..9a44bc13d 100755 --- a/ci/prow/lint +++ b/ci/prow/lint @@ -2,8 +2,6 @@ set -euxo pipefail -export GOCACHE=/tmp - # Generate code and compare with the current source. # Fail with a diff if some files are outdated. go install go.uber.org/mock/mockgen@v0.2.0 @@ -16,4 +14,4 @@ fi export GOLANGCI_LINT_CACHE=/tmp -make lint GOLANGCI_LINT=/usr/bin/golangci-lint +make lint diff --git a/go.mod b/go.mod index d959e9167..ee59dc3c4 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module github.com/rh-ecosystem-edge/kernel-module-management -go 1.21 +go 1.23.0 -toolchain go1.22.2 +toolchain go1.23.4 require ( github.com/a8m/envsubst v1.4.2 diff --git a/internal/controllers/nmc_reconciler_test.go b/internal/controllers/nmc_reconciler_test.go index beec2b684..91174c727 100644 --- a/internal/controllers/nmc_reconciler_test.go +++ b/internal/controllers/nmc_reconciler_test.go @@ -384,10 +384,10 @@ var _ = Describe("NodeModulesConfigReconciler_Reconcile", func() { wh.EXPECT().SyncStatus(ctx, nmc).Return(nil), kubeClient.EXPECT().Get(ctx, types.NamespacedName{Name: nmc.Name}, &node).Return(nil), nm.EXPECT().IsNodeSchedulable(&node, nil).Return(true), - wh.EXPECT().ProcessModuleSpec(contextWithValueMatch, nmc, &spec0, &status0, &node).Return(fmt.Errorf(errorMeassge)), - wh.EXPECT().ProcessUnconfiguredModuleStatus(contextWithValueMatch, nmc, &status2, &node).Return(fmt.Errorf(errorMeassge)), - wh.EXPECT().GarbageCollectInUseLabels(ctx, nmc).Return(fmt.Errorf(errorMeassge)), - wh.EXPECT().UpdateNodeLabels(ctx, nmc, &node).Return(nil, nil, fmt.Errorf(errorMeassge)), + wh.EXPECT().ProcessModuleSpec(contextWithValueMatch, nmc, &spec0, &status0, &node).Return(errors.New(errorMeassge)), + wh.EXPECT().ProcessUnconfiguredModuleStatus(contextWithValueMatch, nmc, &status2, &node).Return(errors.New(errorMeassge)), + wh.EXPECT().GarbageCollectInUseLabels(ctx, nmc).Return(errors.New(errorMeassge)), + wh.EXPECT().UpdateNodeLabels(ctx, nmc, &node).Return(nil, nil, errors.New(errorMeassge)), ) _, err = r.Reconcile(ctx, req)