Skip to content

Commit ec0db8d

Browse files
authored
ci: use go-version-file instead of hardcoded Go version (#285)
Replace all hardcoded GO_VERSION env vars and go-version strings with go-version-file: go.mod across all 4 workflow files. This makes go.mod the single source of truth for the Go version. Previously, bumping Go required updating go.mod, 4 workflow files, and the Dockerfile. With go-version-file, Dependabot's gomod ecosystem handles go.mod bumps and CI workflows automatically read the correct version. Only the Dockerfile digest remains as a separate update (covered by Dependabot's docker ecosystem). Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
1 parent 1a098cb commit ec0db8d

4 files changed

Lines changed: 18 additions & 21 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ concurrency:
1818
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
1919

2020
env:
21-
GO_VERSION: "1.26.4"
2221
GOLANGCI_LINT_VERSION: "v2.12.2"
2322
GOTESTSUM_VERSION: "v1.13.0"
2423
K3D_VERSION: "v5.8.3"
@@ -103,7 +102,7 @@ jobs:
103102

104103
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
105104
with:
106-
go-version: ${{ env.GO_VERSION }}
105+
go-version-file: go.mod
107106
cache: true
108107

109108
- uses: ./.github/actions/install-go-tool
@@ -162,7 +161,7 @@ jobs:
162161

163162
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
164163
with:
165-
go-version: ${{ env.GO_VERSION }}
164+
go-version-file: go.mod
166165
cache: true
167166

168167
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
@@ -261,7 +260,7 @@ jobs:
261260
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
262261
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
263262
with:
264-
go-version: ${{ env.GO_VERSION }}
263+
go-version-file: go.mod
265264
cache: true
266265
- name: Chainsaw dry-run (parse validation)
267266
shell: bash -Eeuo pipefail {0}
@@ -286,7 +285,7 @@ jobs:
286285

287286
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
288287
with:
289-
go-version: ${{ env.GO_VERSION }}
288+
go-version-file: go.mod
290289
cache: true
291290

292291
- uses: ./.github/actions/install-go-tool
@@ -386,7 +385,7 @@ jobs:
386385

387386
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
388387
with:
389-
go-version: ${{ env.GO_VERSION }}
388+
go-version-file: go.mod
390389
cache: true
391390

392391
- uses: ./.github/actions/install-go-tool
@@ -451,7 +450,7 @@ jobs:
451450

452451
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
453452
with:
454-
go-version: ${{ env.GO_VERSION }}
453+
go-version-file: go.mod
455454
cache: true
456455

457456
- uses: ./.github/actions/install-go-tool
@@ -517,7 +516,7 @@ jobs:
517516
with:
518517
cluster-name: ${{ env.K3D_CLUSTER_NAME }}
519518
kubeconfig-path: ${{ runner.temp }}/attune-e2e-${{ github.run_id }}.kubeconfig
520-
go-version: ${{ env.GO_VERSION }}
519+
go-version-file: go.mod
521520
k3d-version: ${{ env.K3D_VERSION }}
522521
k3s-image: ${{ env.K3S_IMAGE }}
523522
cert-manager-version: ${{ env.CERT_MANAGER_VERSION }}
@@ -585,7 +584,7 @@ jobs:
585584

586585
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
587586
with:
588-
go-version: ${{ env.GO_VERSION }}
587+
go-version-file: go.mod
589588
cache: true
590589

591590
- uses: ./.github/actions/install-go-tool
@@ -612,7 +611,7 @@ jobs:
612611

613612
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
614613
with:
615-
go-version: ${{ env.GO_VERSION }}
614+
go-version-file: go.mod
616615
cache: true
617616

618617
- name: Regenerate manifests and deepcopy
@@ -693,7 +692,7 @@ jobs:
693692

694693
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
695694
with:
696-
go-version: ${{ env.GO_VERSION }}
695+
go-version-file: go.mod
697696
cache: true
698697

699698
- uses: ./.github/actions/install-go-tool
@@ -730,7 +729,7 @@ jobs:
730729

731730
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
732731
with:
733-
go-version: ${{ env.GO_VERSION }}
732+
go-version-file: go.mod
734733
cache: true
735734

736735
- uses: ./.github/actions/setup-clean-docker-config

.github/workflows/e2e-nightly.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ concurrency:
3636
cancel-in-progress: true
3737

3838
env:
39-
GO_VERSION: "1.26.4"
4039
K3D_VERSION: "v5.8.3"
4140
CERT_MANAGER_VERSION: "v1.17.2"
4241
PROMETHEUS_IMAGE: "quay.io/prometheus/prometheus:v3.4.1"
@@ -123,7 +122,7 @@ jobs:
123122
124123
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
125124
with:
126-
go-version: ${{ env.GO_VERSION }}
125+
go-version-file: go.mod
127126
cache: true
128127

129128
- name: Cache E2E container images
@@ -408,7 +407,7 @@ jobs:
408407

409408
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
410409
with:
411-
go-version: ${{ env.GO_VERSION }}
410+
go-version-file: go.mod
412411
cache: true
413412

414413
- name: Run fuzz tests (coverage-guided, 30s per target)

.github/workflows/release.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ permissions:
1818
contents: read
1919

2020
env:
21-
GO_VERSION: "1.26.4"
2221
REGISTRY: ghcr.io
2322
IMAGE_NAME: ${{ github.repository }}
2423

@@ -107,7 +106,7 @@ jobs:
107106

108107
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
109108
with:
110-
go-version: ${{ env.GO_VERSION }}
109+
go-version-file: go.mod
111110
cache: true
112111

113112
- name: Check if Docker build is possible
@@ -537,7 +536,7 @@ jobs:
537536

538537
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
539538
with:
540-
go-version: ${{ env.GO_VERSION }}
539+
go-version-file: go.mod
541540
cache: true
542541

543542
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0

.github/workflows/security.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
4444
if: matrix.language == 'go'
4545
with:
46-
go-version: "1.26.4"
46+
go-version-file: go.mod
4747
cache: true
4848

4949
- uses: github/codeql-action/init@87557b9c84dde89fdd9b10e88954ac2f4248e463 # v4.36.1
@@ -74,7 +74,7 @@ jobs:
7474

7575
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
7676
with:
77-
go-version: "1.26.4"
77+
go-version-file: go.mod
7878
cache: true
7979

8080
- uses: ./.github/actions/install-go-tool
@@ -121,7 +121,7 @@ jobs:
121121

122122
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
123123
with:
124-
go-version: "1.26.4"
124+
go-version-file: go.mod
125125
cache: true
126126

127127
- uses: ./.github/actions/setup-clean-docker-config

0 commit comments

Comments
 (0)