Skip to content

Commit 5b9c8aa

Browse files
authored
🌱 Upgrade builder image to Go 1.23 (#1562)
1 parent 87cc2f3 commit 5b9c8aa

File tree

6 files changed

+29
-21
lines changed

6 files changed

+29
-21
lines changed

.builder-image-version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.22
1+
1.0.23

.github/workflows/main-promote-builder-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
name: Promote Latest tag to Caph Builder Image
1111
runs-on: ubuntu-latest
1212
container:
13-
image: ghcr.io/syself/caph-builder:1.0.22
13+
image: ghcr.io/syself/caph-builder:1.0.23
1414
credentials:
1515
username: ${{ github.actor }}
1616
password: ${{ secrets.github_token }}

.github/workflows/pr-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
name: "Lint Pull Request"
2323
runs-on: ubuntu-latest
2424
container:
25-
image: ghcr.io/syself/caph-builder:1.0.22
25+
image: ghcr.io/syself/caph-builder:1.0.23
2626
credentials:
2727
username: ${{ github.actor }}
2828
password: ${{ secrets.github_token }}

.github/workflows/schedule-scan-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
if: github.repository == 'syself/cluster-api-provider-hetzner'
1212
container:
13-
image: ghcr.io/syself/caph-builder:1.0.22
13+
image: ghcr.io/syself/caph-builder:1.0.23
1414
credentials:
1515
username: ${{ github.actor }}
1616
password: ${{ secrets.github_token }}

hack/upgrade-builder-image.sh

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,33 @@
1616

1717
# This script is executed in the Update-Bot container.
1818
# It checks if the Dockerfile for the build container has changed.
19-
# If so, it uses the version of the main branch as the basis for creating a new image tag.
20-
# The script also checks if the image tag for the build image exists in the main branch.
21-
# We assume that only one branch and one PR will be created for the changes in the build container.
19+
# If so, it uses the version of the main branch as the basis for creating a new image tag.
20+
# The script also checks if the image tag for the build image exists in the main branch.
21+
# We assume that only one branch and one PR will be created for the changes in the build container.
2222
# Therefore, we can update this branch as many times as we want and reuse the next available tag after the one from the main branch.
2323

24-
set -o errexit
25-
set -o nounset
26-
set -o pipefail
24+
# Usage:
25+
# Step 1: Update images/builder/Dockerfile (for example increate Go version)
26+
# Step 2: Update .builder-image-version.txt
27+
# Step 3: Run this script
28+
29+
# Bash Strict Mode: https://github.com/guettli/bash-strict-mode
30+
trap 'echo "Warning: A command has failed. Exiting the script. Line was ($0:$LINENO): $(sed -n "${LINENO}p" "$0")"; exit 3' ERR
2731

2832
export BUILDER_IMAGE=ghcr.io/syself/caph-builder
2933

30-
REPO_ROOT=$(realpath $(dirname "${BASH_SOURCE[0]}")/..)
34+
REPO_ROOT=$(realpath "$(dirname "${BASH_SOURCE[0]}")/..")
3135
cd "${REPO_ROOT}" || exit 1
3236

37+
# shellcheck disable=SC1091
3338
source "${REPO_ROOT}/hack/semver-upgrade.sh"
3439

35-
if git diff --exit-code .builder-image-version.txt images/builder/Dockerfile images/builder/build.sh > /dev/null; then
40+
if git diff --exit-code .builder-image-version.txt images/builder/Dockerfile images/builder/build.sh >/dev/null; then
3641
echo "nothing seems to have changed."
3742
exit 0
3843
fi
3944

40-
if [ "${CI:-false}" = true ] ; then
45+
if [ "${CI:-false}" = true ]; then
4146
echo "$BUILD_IMAGE_TOKEN" | docker login ghcr.io -u "$BUILD_IMAGE_USER" --password-stdin
4247
fi
4348

@@ -51,19 +56,22 @@ export VERSION
5156
NEW_VERSION=$(semver_upgrade patch "$VERSION")
5257
export NEW_VERSION
5358

54-
if ! docker manifest inspect "$BUILDER_IMAGE:$VERSION" > /dev/null; then
59+
if ! docker manifest inspect "$BUILDER_IMAGE:$VERSION" >/dev/null; then
5560
echo "could not find image $BUILDER_IMAGE:$VERSION"
5661
exit 1
5762
fi
58-
echo "$NEW_VERSION" > .builder-image-version.txt
63+
echo "$NEW_VERSION" >.builder-image-version.txt
5964
echo "Wrote new version $NEW_VERSION to .builder-image-version.txt"
6065

61-
if docker manifest inspect ghcr.io/syself/caph-builder:${NEW_VERSION} > /dev/null ; echo $?; then
62-
66+
if
67+
docker manifest inspect ghcr.io/syself/caph-builder:"${NEW_VERSION}" >/dev/null
68+
echo $?
69+
then
70+
6371
sed -i -e "/^BUILDER_IMAGE_VERSION /s/:=.*$/:= ${NEW_VERSION}/" Makefile
6472
grep -r -E 'ghcr.io/syself/caph-builder:[0-9].*.*' -l | xargs sed -i -e "s/ghcr.io\/syself\/caph-builder:${VERSION}/ghcr.io\/syself\/caph-builder:${NEW_VERSION}/g"
65-
docker build -t ghcr.io/syself/caph-builder:${NEW_VERSION} ./images/builder
66-
docker push ghcr.io/syself/caph-builder:${NEW_VERSION}
73+
docker build -t ghcr.io/syself/caph-builder:"${NEW_VERSION}" ./images/builder
74+
docker push ghcr.io/syself/caph-builder:"${NEW_VERSION}"
6775
else
6876
exit 1
69-
fi
77+
fi

images/builder/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ FROM docker.io/aquasec/trivy:0.60.0@sha256:91c3a842834563a6860dbaec5af7c1949df5c
4545
############################
4646
# Caph Build Image Base #
4747
############################
48-
FROM docker.io/library/golang:1.22.6-bullseye@sha256:3bc1984c6725fdc2ac075004a2aa52131cccc95d2d69fd7b934d343b669e0aa7
48+
FROM docker.io/library/golang:1.23.7-bullseye@sha256:c4f892cd1906e6bf8a0e181f48babf76331c6f5dc786b709ffc9f591cb7edece
4949

5050
# update: datasource=repology depName=debian_11/skopeo versioning=loose
5151
ENV SKOPEO_VERSION="1.2.2+dfsg1-1+b6"

0 commit comments

Comments
 (0)