Skip to content

Commit

Permalink
Merge pull request GoogleCloudPlatform#1963 from justinsb/update_gola…
Browse files Browse the repository at this point in the history
…ng_1_22_4

Add script to update golang; bump to 1.22.4
  • Loading branch information
google-oss-prow[bot] authored Jun 6, 2024
2 parents a26493b + 066d3dd commit d44ff80
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 13 deletions.
2 changes: 1 addition & 1 deletion build/builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion build/tooling/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]

Expand Down
39 changes: 39 additions & 0 deletions dev/codebots/update-golang-version
Original file line number Diff line number Diff line change
@@ -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/
2 changes: 1 addition & 1 deletion experiments/composite/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module github.com/GoogleCloudPlatform/k8s-config-connector/experiments/composite

go 1.22

toolchain go1.22.3
toolchain go1.22.4
2 changes: 1 addition & 1 deletion experiments/compositions/composition/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion experiments/compositions/composition/Dockerfile.inline
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion experiments/compositions/composition/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion experiments/compositions/facade/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion experiments/compositions/facade/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module facade

go 1.22

toolchain go1.22.3
toolchain go1.22.4

require (
k8s.io/apimachinery v0.28.3
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion mockgcp/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion operator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d44ff80

Please sign in to comment.