Skip to content

Commit 631aaf0

Browse files
authored
Repo controlled build go version (#3598)
1 parent 20e667d commit 631aaf0

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

.github/workflows/deps.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ jobs:
3939
uses: actions/checkout@v4
4040
with:
4141
show-progress: false
42+
- name: Setup Go Version
43+
run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV
4244
- id: govulncheck
4345
uses: golang/govulncheck-action@v1
4446
with:
45-
go-version-input: 1.21.5
47+
go-version-input: ${{ env.GO_VERSION }}
4648
go-version-file: go.mod

.github/workflows/test.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,21 @@ jobs:
77
name: Build
88
runs-on: ubuntu-latest
99
steps:
10+
- name: Setup Go Version
11+
run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV
1012
- name: Set up Go 1.x
1113
uses: actions/setup-go@v2
1214
with:
13-
go-version: ^1.21
14-
15+
go-version: ${{ env.GO_VERSION }}
16+
1517
- name: Check out code into the Go module directory
1618
uses: actions/checkout@v2
1719

1820
- name: Run unit tests
1921
run: |
2022
sudo snap install yq
2123
make test
22-
24+
2325
- name: Codecov
2426
uses: codecov/codecov-action@v1
2527
with:
@@ -32,4 +34,4 @@ jobs:
3234

3335
- name: make quick-ci
3436
run: |
35-
make quick-ci
37+
make quick-ci

.go-version

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

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ MAKEFILE_PATH = $(dir $(realpath -s $(firstword $(MAKEFILE_LIST))))
44
# Image URL to use all building/pushing image targets
55
IMG ?= public.ecr.aws/eks/aws-load-balancer-controller:v2.7.0
66
# Image URL to use for builder stage in Docker build
7-
BUILD_IMAGE ?= public.ecr.aws/docker/library/golang:1.21.5
7+
GOLANG_VERSION ?= $(shell cat .go-version)
8+
BUILD_IMAGE ?= public.ecr.aws/docker/library/golang:$(GOLANG_VERSION)
89
# Image URL to use for base layer in Docker build
910
BASE_IMAGE ?= public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-nonroot:2023-09-06-1694026927.2
1011
IMG_PLATFORM ?= linux/amd64,linux/arm64
@@ -24,6 +25,9 @@ else
2425
GOBIN=$(shell go env GOBIN)
2526
endif
2627

28+
export GOSUMDB = sum.golang.org
29+
export GOTOOLCHAIN = go$(GOLANG_VERSION)
30+
2731
all: controller
2832

2933
# Run tests

0 commit comments

Comments
 (0)