Skip to content

Commit

Permalink
Repo controlled build go version (#3598)
Browse files Browse the repository at this point in the history
  • Loading branch information
xdu31 authored Mar 14, 2024
1 parent 20e667d commit 631aaf0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ jobs:
uses: actions/checkout@v4
with:
show-progress: false
- name: Setup Go Version
run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV
- id: govulncheck
uses: golang/govulncheck-action@v1
with:
go-version-input: 1.21.5
go-version-input: ${{ env.GO_VERSION }}
go-version-file: go.mod
10 changes: 6 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- name: Setup Go Version
run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.21
go-version: ${{ env.GO_VERSION }}

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Run unit tests
run: |
sudo snap install yq
make test
- name: Codecov
uses: codecov/codecov-action@v1
with:
Expand All @@ -32,4 +34,4 @@ jobs:

- name: make quick-ci
run: |
make quick-ci
make quick-ci
1 change: 1 addition & 0 deletions .go-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.21.5
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ MAKEFILE_PATH = $(dir $(realpath -s $(firstword $(MAKEFILE_LIST))))
# Image URL to use all building/pushing image targets
IMG ?= public.ecr.aws/eks/aws-load-balancer-controller:v2.7.0
# Image URL to use for builder stage in Docker build
BUILD_IMAGE ?= public.ecr.aws/docker/library/golang:1.21.5
GOLANG_VERSION ?= $(shell cat .go-version)
BUILD_IMAGE ?= public.ecr.aws/docker/library/golang:$(GOLANG_VERSION)
# Image URL to use for base layer in Docker build
BASE_IMAGE ?= public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-nonroot:2023-09-06-1694026927.2
IMG_PLATFORM ?= linux/amd64,linux/arm64
Expand All @@ -24,6 +25,9 @@ else
GOBIN=$(shell go env GOBIN)
endif

export GOSUMDB = sum.golang.org
export GOTOOLCHAIN = go$(GOLANG_VERSION)

all: controller

# Run tests
Expand Down

0 comments on commit 631aaf0

Please sign in to comment.