From acae9234625bef4f9957fb453bc4f575e447522a Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 18 Jan 2023 22:05:40 -0800 Subject: [PATCH 1/4] Upgrade gitlab-operator-build-base image to Go 1.18.10 This image was failing to build on master since a number of dependencies now require Go 1.17+. Relates to https://gitlab.com/gitlab-org/gitlab-build-images/-/issues/114 --- Dockerfile.gitlab-operator-build-base | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Dockerfile.gitlab-operator-build-base b/Dockerfile.gitlab-operator-build-base index 9f12a73..3fcff50 100644 --- a/Dockerfile.gitlab-operator-build-base +++ b/Dockerfile.gitlab-operator-build-base @@ -1,8 +1,6 @@ -ARG GOLANG_VERSION=1.16 -ARG ALPINE_VERSION=3.14 -# 3.14 presents challenges: https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.14.0#faccessat2 -# while building OPM. 3.13 has no issues -ARG OPM_ALPINE_VERSION=3.13 +ARG GOLANG_VERSION=1.18 +ARG ALPINE_VERSION=3.15 +ARG OPM_ALPINE_VERSION=3.15 ## Opm From 358b1623a0e2ca58435ebd9ed524f2c6ebdc6704 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Thu, 19 Jan 2023 10:20:03 -0800 Subject: [PATCH 2/4] Fix installation and upgrade kustomize version to 4.5.7 for gitlab-operator-base These changes were necessary for Go 1.18 to build. --- Dockerfile.gitlab-operator-build-base | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Dockerfile.gitlab-operator-build-base b/Dockerfile.gitlab-operator-build-base index 3fcff50..d51a100 100644 --- a/Dockerfile.gitlab-operator-build-base +++ b/Dockerfile.gitlab-operator-build-base @@ -23,13 +23,11 @@ RUN mkdir -p /src \ ## Kustomize FROM golang:${GOLANG_VERSION}-alpine${ALPINE_VERSION} as kustomize -ARG KUSTOMIZE_VERSION=3.8.10 +ARG KUSTOMIZE_VERSION=4.5.7 ENV GOPROXY="https://proxy.golang.org/" RUN apk add --no-cache gcc musl-dev -RUN mkdir /src && cd /src; \ - go mod init tmp && \ - go get sigs.k8s.io/kustomize/kustomize/v3@v${KUSTOMIZE_VERSION} +RUN go install sigs.k8s.io/kustomize/kustomize/v4@v${KUSTOMIZE_VERSION} ## Controller-gen FROM golang:${GOLANG_VERSION}-alpine${ALPINE_VERSION} as controller-gen @@ -37,9 +35,7 @@ FROM golang:${GOLANG_VERSION}-alpine${ALPINE_VERSION} as controller-gen ARG CONTROLLER_GEN_VERSION=0.7.0 ENV GOPROXY="https://proxy.golang.org/" -RUN mkdir /src && cd /src; \ - go mod init tmp \ - && go get sigs.k8s.io/controller-tools/cmd/controller-gen@v${CONTROLLER_GEN_VERSION} +RUN go install sigs.k8s.io/controller-tools/cmd/controller-gen@v${CONTROLLER_GEN_VERSION} ## Build FROM golang:${GOLANG_VERSION}-alpine${ALPINE_VERSION} as build @@ -61,9 +57,9 @@ RUN apk add --no-cache podman buildah curl make gcc musl-dev git bash coreutils # accomodate running podman within docker RUN sed -i 's#^driver.*$#driver = "vfs"#g' /etc/containers/storage.conf -RUN go get -u \ - github.com/onsi/ginkgo/ginkgo \ - golang.org/x/lint/golint +ARG GINKGO_VERSION=1.16.5 +RUN go install github.com/onsi/ginkgo/ginkgo@v${GINKGO_VERSION} +RUN go install golang.org/x/lint/golint@latest # Kubebuilder RUN mkdir -p /usr/local/kubebuilder/bin \ From 28441fce5769df40baa371c9f01db8dc3f10e662 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Mon, 23 Jan 2023 13:06:26 -0800 Subject: [PATCH 3/4] Rename operator-base image to include Golang version This will prevent unexpected errors when trying to update Go versions. --- .gitlab/ci/custom.images.yml | 2 +- ...ld-base => Dockerfile.gitlab-operator-build-base-golang-1.18 | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename Dockerfile.gitlab-operator-build-base => Dockerfile.gitlab-operator-build-base-golang-1.18 (100%) diff --git a/.gitlab/ci/custom.images.yml b/.gitlab/ci/custom.images.yml index 6c53072..550cde0 100644 --- a/.gitlab/ci/custom.images.yml +++ b/.gitlab/ci/custom.images.yml @@ -58,7 +58,7 @@ golangci-lint-alpine: extends: .build_and_deploy # Used by gitlab-operator: https://gitlab.com/gitlab-org/gl-openshift/gitlab-operator -gitlab-operator-build-base: +gitlab-operator-build-base-golang-1.18: extends: .build_and_deploy alpine-bash-jq-curl-git: diff --git a/Dockerfile.gitlab-operator-build-base b/Dockerfile.gitlab-operator-build-base-golang-1.18 similarity index 100% rename from Dockerfile.gitlab-operator-build-base rename to Dockerfile.gitlab-operator-build-base-golang-1.18 From a34c61451f257be1702f5dedf7b554d3e0614735 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Mon, 23 Jan 2023 14:21:01 -0800 Subject: [PATCH 4/4] Update gitlab-operator URL It has moved to https://gitlab.com/gitlab-org/cloud-native/gitlab-operator. --- .gitlab/ci/custom.images.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/ci/custom.images.yml b/.gitlab/ci/custom.images.yml index 550cde0..50ea18f 100644 --- a/.gitlab/ci/custom.images.yml +++ b/.gitlab/ci/custom.images.yml @@ -57,7 +57,7 @@ terraform: golangci-lint-alpine: extends: .build_and_deploy -# Used by gitlab-operator: https://gitlab.com/gitlab-org/gl-openshift/gitlab-operator +# Used by gitlab-operator: https://gitlab.com/gitlab-org/cloud-native/gitlab-operator gitlab-operator-build-base-golang-1.18: extends: .build_and_deploy