Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0c07474

Browse files
authored
fix(ci): manually select Go version (coder#7654)
1 parent f72d8e9 commit 0c07474

File tree

4 files changed

+23
-33
lines changed

4 files changed

+23
-33
lines changed

.github/workflows/ci.yaml

+9-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
- main
77

88
pull_request:
9-
109
workflow_dispatch:
1110

1211
permissions:
@@ -27,6 +26,9 @@ concurrency:
2726
group: ${{ github.workflow }}-${{ github.ref }}
2827
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
2928

29+
env:
30+
CODER_GO_VERSION: "~1.20"
31+
3032
jobs:
3133
lint:
3234
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-8-cores' || 'ubuntu-latest' }}
@@ -37,7 +39,7 @@ jobs:
3739
# Install Go!
3840
- uses: actions/setup-go@v4
3941
with:
40-
go-version: "~1.20"
42+
go-version: ${{ env.CODER_GO_VERSION }}
4143

4244
# Check for any typos!
4345
- name: Check for typos
@@ -153,7 +155,7 @@ jobs:
153155
- uses: actions/setup-go@v4
154156
with:
155157
cache: false
156-
go-version: "~1.20"
158+
go-version: ${{ env.CODER_GO_VERSION }}
157159

158160
- name: Echo Go Cache Paths
159161
id: go-cache-paths
@@ -256,7 +258,7 @@ jobs:
256258
- uses: actions/setup-go@v4
257259
with:
258260
cache: false
259-
go-version: "~1.20"
261+
go-version: ${{ env.CODER_GO_VERSION }}
260262

261263
- name: Echo Go Cache Paths
262264
id: go-cache-paths
@@ -345,7 +347,7 @@ jobs:
345347
- uses: actions/setup-go@v4
346348
with:
347349
cache: false
348-
go-version: "~1.20"
350+
go-version: ${{ env.CODER_GO_VERSION }}
349351

350352
- name: Echo Go Cache Paths
351353
id: go-cache-paths
@@ -437,7 +439,7 @@ jobs:
437439
- uses: actions/setup-go@v4
438440
with:
439441
cache: false
440-
go-version: "~1.20"
442+
go-version: ${{ env.CODER_GO_VERSION }}
441443

442444
- name: Echo Go Cache Paths
443445
id: go-cache-paths
@@ -589,7 +591,7 @@ jobs:
589591
- uses: actions/setup-go@v4
590592
with:
591593
cache: false
592-
go-version: "~1.20"
594+
go-version: ${{ env.CODER_GO_VERSION }}
593595

594596
- uses: hashicorp/setup-terraform@v2
595597
with:

.github/workflows/release.yaml

+8-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ on:
66
- "v*"
77
workflow_dispatch:
88
inputs:
9+
# For some reason, setup-go won't actually pick up a new patch version if
10+
# it has an old one cached. We need to manually specify the versions so we
11+
# can get the latest release. Never use "~1.xx" here!
12+
go_version:
13+
description: "Go version to use for building."
14+
required: false
15+
default: "1.20.4"
916
dry_run:
1017
description: Perform a dry-run release (devel). Note that ref must be an annotated tag when run without dry-run.
1118
type: boolean
@@ -92,7 +99,7 @@ jobs:
9299

93100
- uses: actions/setup-go@v4
94101
with:
95-
go-version: "~1.20"
102+
go-version: ${{ inputs.go_version }}
96103

97104
- name: Cache Node
98105
id: cache-node

.github/workflows/security.yaml

+5-24
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ concurrency:
1818
group: ${{ github.workflow }}-${{ github.ref }}-security
1919
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
2020

21+
env:
22+
CODER_GO_VERSION: "1.20.4"
23+
2124
jobs:
2225
codeql:
2326
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-8-cores' || 'ubuntu-latest' }}
@@ -32,18 +35,7 @@ jobs:
3235
- name: Setup Go
3336
uses: actions/setup-go@v4
3437
with:
35-
go-version: "~1.20"
36-
37-
- name: Go Cache Paths
38-
id: go-cache-paths
39-
run: |
40-
echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
41-
42-
- name: Go Mod Cache
43-
uses: actions/cache@v3
44-
with:
45-
path: ${{ steps.go-cache-paths.outputs.GOMODCACHE }}
46-
key: ${{ runner.os }}-release-go-mod-${{ hashFiles('**/go.sum') }}
38+
go-version: ${{ env.CODER_GO_VERSION }}
4739

4840
# Workaround to prevent CodeQL from building the dashboard.
4941
- name: Remove Makefile
@@ -73,18 +65,7 @@ jobs:
7365

7466
- uses: actions/setup-go@v4
7567
with:
76-
go-version: "~1.20"
77-
78-
- name: Go Cache Paths
79-
id: go-cache-paths
80-
run: |
81-
echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
82-
83-
- name: Go Mod Cache
84-
uses: actions/cache@v3
85-
with:
86-
path: ${{ steps.go-cache-paths.outputs.GOMODCACHE }}
87-
key: ${{ runner.os }}-release-go-mod-${{ hashFiles('**/go.sum') }}
68+
go-version: ${{ env.CODER_GO_VERSION }}
8869

8970
- name: Cache Node
9071
id: cache-node

dogfood/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ FROM ubuntu:jammy AS go
88

99
RUN apt-get update && apt-get install --yes curl gcc
1010
# Install Go manually, so that we can control the version
11-
ARG GO_VERSION=1.20
11+
ARG GO_VERSION=1.20.4
1212
RUN mkdir --parents /usr/local/go
1313

1414
# Boring Go is needed to build FIPS-compliant binaries.

0 commit comments

Comments
 (0)