From c154dbba705c1113da52528bba7ee7e35ef84564 Mon Sep 17 00:00:00 2001 From: justinsb Date: Thu, 6 Jun 2024 10:54:14 -0400 Subject: [PATCH 1/2] chore: add script to update golang version --- dev/codebots/update-golang-version | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 dev/codebots/update-golang-version diff --git a/dev/codebots/update-golang-version b/dev/codebots/update-golang-version new file mode 100755 index 0000000000..46271030b3 --- /dev/null +++ b/dev/codebots/update-golang-version @@ -0,0 +1,39 @@ +#!/bin/bash + +set -o errexit +set -o nounset +set -o pipefail + +set -x + + +REPO_ROOT=$(git rev-parse --show-toplevel) +cd ${REPO_ROOT} + + +GO_TOOLCHAIN=$(curl https://go.dev/dl/?mode=json | jq -r '[.[] | select(.stable == true)] | .[0].version') +echo "GO_TOOLCHAIN=$GO_TOOLCHAIN" + +# GO_VERSION is the GO_TOOLCHAIN without the go prefix +GO_VERSION=${GO_TOOLCHAIN#go} +echo "GO_VERSION=$GO_VERSION" + +# Update go.mod files +cd ${REPO_ROOT} +for f in $(git ls-files 'go.mod' '**/go.mod'); do + cd ${REPO_ROOT} + cd $(dirname $f) + echo "Updating $f to toolchain $GO_TOOLCHAIN" + go mod edit -toolchain=${GO_TOOLCHAIN} +done + +# Update Docker images +cd ${REPO_ROOT} +for f in $(git ls-files 'Dockerfile*' '**/Dockerfile*'); do + echo "Updating Dockerfile $f to go image $GO_VERSION" + sed -i -e "s/FROM golang:[0-9.]*/FROM golang:$GO_VERSION/g" $f +done + +# Ignore third_party changes +cd ${REPO_ROOT} +git co -- third_party/ \ No newline at end of file From 066d3ddba4ce2db0c7433c585441420f6ae82635 Mon Sep 17 00:00:00 2001 From: justinsb Date: Thu, 6 Jun 2024 10:53:57 -0400 Subject: [PATCH 2/2] versionbump: update to golang 1.22.4 --- build/builder/Dockerfile | 2 +- build/tooling/Dockerfile | 2 +- experiments/composite/go.mod | 2 +- experiments/compositions/composition/Dockerfile | 2 +- experiments/compositions/composition/Dockerfile.getter.expander | 2 +- experiments/compositions/composition/Dockerfile.inline | 2 +- experiments/compositions/composition/Dockerfile.jinja2.expander | 2 +- experiments/compositions/composition/go.mod | 2 +- experiments/compositions/facade/Dockerfile | 2 +- experiments/compositions/facade/go.mod | 2 +- go.mod | 2 +- mockgcp/go.mod | 2 +- operator/Dockerfile | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/build/builder/Dockerfile b/build/builder/Dockerfile index 1b3c78a961..9b75fee0db 100644 --- a/build/builder/Dockerfile +++ b/build/builder/Dockerfile @@ -14,7 +14,7 @@ # This Dockerfile builds an image containing builds of all the binaries built # from source (manager, webhook, etc.) -FROM golang:1.22.3 AS builder +FROM golang:1.22.4 AS builder # Copy in the Go source code WORKDIR /go/src/github.com/GoogleCloudPlatform/k8s-config-connector diff --git a/build/tooling/Dockerfile b/build/tooling/Dockerfile index 99fe8f3aa6..c5848b274f 100644 --- a/build/tooling/Dockerfile +++ b/build/tooling/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM golang:1.22 AS builder +FROM golang:1.22.4 AS builder RUN GO111MODULE=on go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.15.0 diff --git a/experiments/composite/go.mod b/experiments/composite/go.mod index bf3f0a6401..ef8f6dfa06 100644 --- a/experiments/composite/go.mod +++ b/experiments/composite/go.mod @@ -2,4 +2,4 @@ module github.com/GoogleCloudPlatform/k8s-config-connector/experiments/composite go 1.22 -toolchain go1.22.3 +toolchain go1.22.4 diff --git a/experiments/compositions/composition/Dockerfile b/experiments/compositions/composition/Dockerfile index 9718727305..e92686d1ea 100644 --- a/experiments/compositions/composition/Dockerfile +++ b/experiments/compositions/composition/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. # Build the manager binary -FROM golang:1.22.3 as builder +FROM golang:1.22.4 as builder ARG TARGETOS ARG TARGETARCH diff --git a/experiments/compositions/composition/Dockerfile.getter.expander b/experiments/compositions/composition/Dockerfile.getter.expander index 0c1e49a025..eca1ca7e5e 100644 --- a/experiments/compositions/composition/Dockerfile.getter.expander +++ b/experiments/compositions/composition/Dockerfile.getter.expander @@ -17,7 +17,7 @@ # ----------------- Build Container --------------------------- # Build the go app. # Explicitly set to latest vs golang:1.22 -FROM golang:1.22 AS build-stage +FROM golang:1.22.4 AS build-stage # Set destination for COPY WORKDIR /go/src/app diff --git a/experiments/compositions/composition/Dockerfile.inline b/experiments/compositions/composition/Dockerfile.inline index 7b1d22d4bc..33ece9a512 100644 --- a/experiments/compositions/composition/Dockerfile.inline +++ b/experiments/compositions/composition/Dockerfile.inline @@ -2,7 +2,7 @@ # ----------------- Build Container --------------------------- # Build the go app. -FROM golang:1.22.3 AS build-stage +FROM golang:1.22.4 AS build-stage # Set destination for COPY WORKDIR /go/src/app diff --git a/experiments/compositions/composition/Dockerfile.jinja2.expander b/experiments/compositions/composition/Dockerfile.jinja2.expander index dcdd33a6e4..4d41e01e50 100644 --- a/experiments/compositions/composition/Dockerfile.jinja2.expander +++ b/experiments/compositions/composition/Dockerfile.jinja2.expander @@ -17,7 +17,7 @@ # ----------------- Build Container --------------------------- # Build the go app. # Explicitly set to latest vs golang:1.22 -FROM golang:1.22 AS build-stage +FROM golang:1.22.4 AS build-stage # Set destination for COPY WORKDIR /go/src/app diff --git a/experiments/compositions/composition/go.mod b/experiments/compositions/composition/go.mod index 9e4a208961..edc3cb87d4 100644 --- a/experiments/compositions/composition/go.mod +++ b/experiments/compositions/composition/go.mod @@ -2,7 +2,7 @@ module google.com/composition go 1.22.0 -toolchain go1.22.3 +toolchain go1.22.4 require ( github.com/Masterminds/semver/v3 v3.2.1 diff --git a/experiments/compositions/facade/Dockerfile b/experiments/compositions/facade/Dockerfile index e157a0ef48..b7c86e4b1d 100644 --- a/experiments/compositions/facade/Dockerfile +++ b/experiments/compositions/facade/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. # Build the manager binary -FROM golang:1.22.3 as builder +FROM golang:1.22.4 as builder ARG TARGETOS ARG TARGETARCH diff --git a/experiments/compositions/facade/go.mod b/experiments/compositions/facade/go.mod index 657b15c374..7305052322 100644 --- a/experiments/compositions/facade/go.mod +++ b/experiments/compositions/facade/go.mod @@ -2,7 +2,7 @@ module facade go 1.22 -toolchain go1.22.3 +toolchain go1.22.4 require ( k8s.io/apimachinery v0.28.3 diff --git a/go.mod b/go.mod index d795b4e2e3..5fedf4ceb0 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/GoogleCloudPlatform/k8s-config-connector go 1.22 -toolchain go1.22.3 +toolchain go1.22.4 replace github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp => ./mockgcp diff --git a/mockgcp/go.mod b/mockgcp/go.mod index ef3ec24843..46f176733b 100644 --- a/mockgcp/go.mod +++ b/mockgcp/go.mod @@ -2,7 +2,7 @@ module github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp go 1.22 -toolchain go1.22.3 +toolchain go1.22.4 require ( cloud.google.com/go/compute v1.23.0 diff --git a/operator/Dockerfile b/operator/Dockerfile index f08abc034a..ced41bd81c 100644 --- a/operator/Dockerfile +++ b/operator/Dockerfile @@ -15,7 +15,7 @@ # This Dockefile builds a thin image containing the manager binary # Build the manager binary -FROM golang:1.22.3 AS builder +FROM golang:1.22.4 AS builder # Copy in the Go source code WORKDIR /go/src/github.com/GoogleCloudPlatform/k8s-config-connector