Skip to content

Commit 5acc423

Browse files
authored
Bump go to v1.21.6 and set a single source of truth (#10926)
1 parent 02e6ebc commit 5acc423

File tree

24 files changed

+166
-50
lines changed

24 files changed

+166
-50
lines changed

.github/workflows/ci.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,14 @@ jobs:
7878
- name: Checkout
7979
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
8080

81+
- name: Get go version
82+
run: echo "GOLANG_VERSION=$(cat GOLANG_VERSION)" >> $GITHUB_ENV
83+
8184
- name: Set up Go
8285
id: go
8386
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
8487
with:
85-
go-version: '1.21.5'
88+
go-version: ${{ env.GOLANG_VERSION }}
8689
check-latest: true
8790

8891
- name: Run test
@@ -92,6 +95,8 @@ jobs:
9295
name: Build
9396
runs-on: ubuntu-latest
9497
needs: changes
98+
outputs:
99+
golangversion: ${{ steps.golangversion.outputs.version }}
95100
if: |
96101
(needs.changes.outputs.go == 'true') || (needs.changes.outputs.charts == 'true') || (needs.changes.outputs.baseimage == 'true')
97102
@@ -100,12 +105,17 @@ jobs:
100105
steps:
101106
- name: Checkout
102107
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
108+
109+
- name: Get go version
110+
id: golangversion
111+
run: |
112+
echo "version=$(cat GOLANG_VERSION)" >> "$GITHUB_OUTPUT"
103113
104114
- name: Set up Go
105115
id: go
106116
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
107117
with:
108-
go-version: '1.21.5'
118+
go-version: ${{ steps.golangversion.outputs.version }}
109119
check-latest: true
110120

111121
- name: Set up QEMU
@@ -177,7 +187,7 @@ jobs:
177187
- name: Setup Go
178188
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
179189
with:
180-
go-version: '1.21.5'
190+
go-version: ${{ needs.build.outputs.golangversion }}
181191
check-latest: true
182192

183193
- name: Install Helm Unit Test Plugin

.github/workflows/golangci-lint.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@ jobs:
1818
- name: Checkout
1919
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
2020

21+
- name: Get go version
22+
run: echo "GOLANG_VERSION=$(cat GOLANG_VERSION)" >> $GITHUB_ENV
23+
2124
- name: Set up Go
2225
id: go
2326
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
2427
with:
25-
go-version: '1.21.5'
28+
go-version: ${{ env.GOLANG_VERSION }}
2629
check-latest: true
2730

2831
- name: golangci-lint

.github/workflows/images.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,19 @@ jobs:
142142
(needs.changes.outputs.kube-webhook-certgen == 'true')
143143
strategy:
144144
matrix:
145-
k8s: [v1.25.11, v1.26.6, v1.27.3, v1.28.0, 1.29.0]
145+
k8s: [v1.25.11, v1.26.6, v1.27.3, v1.28.0, v1.29.0]
146146
steps:
147147
- name: Checkout
148148
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
149+
150+
- name: Get go version
151+
run: echo "GOLANG_VERSION=$(cat GOLANG_VERSION)" >> $GITHUB_ENV
152+
149153
- name: Set up Go
150154
id: go
151155
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
152156
with:
153-
go-version: '1.21.5'
157+
go-version: ${{ env.GOLANG_VERSION }}
154158
check-latest: true
155159
- name: image build
156160
run: |

.github/workflows/plugin.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ jobs:
1616
with:
1717
fetch-depth: 0
1818

19+
- name: Get go version
20+
run: echo "GOLANG_VERSION=$(cat GOLANG_VERSION)" >> $GITHUB_ENV
21+
1922
- name: Set up Go
2023
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
2124
with:
22-
go-version: '1.21.5'
25+
go-version: ${{ env.GOLANG_VERSION }}
2326
check-latest: true
2427

2528
- name: Run GoReleaser Snapshot

GOLANG_VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.21.6

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ SHELL=/bin/bash -o pipefail -o errexit
2929
# Use the 0.0 tag for testing, it shouldn't clobber any release builds
3030
TAG ?= $(shell cat TAG)
3131

32+
GOLANG_VERSION ?= $(shell cat GOLANG_VERSION)
33+
3234
# e2e settings
3335
# Allow limiting the scope of the e2e tests. By default run everything
3436
FOCUS ?=
@@ -105,7 +107,7 @@ clean-chroot-image: ## Removes local image
105107

106108
.PHONY: build
107109
build: ## Build ingress controller, debug tool and pre-stop hook.
108-
build/run-in-docker.sh \
110+
E2E_IMAGE=golang:$(GOLANG_VERSION)-alpine3.19 USE_SHELL=/bin/sh build/run-in-docker.sh \
109111
MAC_OS=$(MAC_OS) \
110112
PKG=$(PKG) \
111113
ARCH=$(ARCH) \

build/build.sh

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

33
# Copyright 2018 The Kubernetes Authors.
44
#
@@ -25,24 +25,15 @@ set -o errexit
2525
set -o nounset
2626
set -o pipefail
2727

28-
declare -a mandatory
29-
mandatory=(
30-
PKG
31-
ARCH
32-
COMMIT_SHA
33-
REPO_INFO
34-
TAG
35-
)
3628

37-
for var in "${mandatory[@]}"; do
38-
if [[ -z "${!var:-}" ]]; then
39-
echo "Environment variable $var must be set"
40-
exit 1
41-
fi
42-
done
29+
if [ -z "$PKG" ] || [ -z "$ARCH" ] || [ -z "$COMMIT_SHA" ] || [ -z "$REPO_INFO" ] || [ -z "$TAG" ]; then
30+
echo "Environments PKG, ARCH, COMMIT_SHA, REPO_INFO and TAG are required"
31+
exit 1
32+
fi
33+
4334

4435
export CGO_ENABLED=0
45-
export GOARCH=${ARCH}
36+
export GOARCH="${ARCH}"
4637

4738
TARGETS_DIR="rootfs/bin/${ARCH}"
4839
echo "Building targets for ${ARCH}, generated targets in ${TARGETS_DIR} directory."
@@ -75,4 +66,4 @@ ${GO_BUILD_CMD} \
7566
-X ${PKG}/version.COMMIT=${COMMIT_SHA} \
7667
-X ${PKG}/version.REPO=${REPO_INFO}" \
7768
-buildvcs=false \
78-
-o "${TARGETS_DIR}/wait-shutdown" "${PKG}/cmd/waitshutdown"
69+
-o "${TARGETS_DIR}/wait-shutdown" "${PKG}/cmd/waitshutdown"

build/run-in-docker.sh

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,7 @@ fi
7676

7777
USER=${USER:-nobody}
7878

79-
#echo "..printing env & other vars to stdout"
80-
#echo "HOSTNAME=`hostname`"
81-
#uname -a
82-
#env
83-
#echo "DIND_ENABLED=$DOCKER_IN_DOCKER_ENABLED"
84-
#echo "done..printing env & other vars to stdout"
79+
USE_SHELL=${USE_SHELL:-"/bin/bash"}
8580

8681
if [[ "$DOCKER_IN_DOCKER_ENABLED" == "true" ]]; then
8782
echo "..reached DIND check TRUE block, inside run-in-docker.sh"
@@ -100,5 +95,5 @@ else
10095
args="$args -v /var/run/docker.sock:/var/run/docker.sock"
10196
fi
10297

103-
${RUNTIME} run $args ${E2E_IMAGE} /bin/bash -c "${FLAGS}"
104-
fi
98+
${RUNTIME} run $args ${E2E_IMAGE} ${USE_SHELL} -c "${FLAGS}"
99+
fi

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module k8s.io/ingress-nginx
22

3-
go 1.21.5
3+
go 1.21
44

55
require (
66
dario.cat/mergo v1.0.0

go.work

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
go 1.21.5
1+
go 1.21
22

33
use (
44
.

0 commit comments

Comments
 (0)