Skip to content

Commit f8696a0

Browse files
committed
backport of commit ea888cd
1 parent 14a549d commit f8696a0

16 files changed

+188
-77
lines changed

.github/workflows/build-artifacts.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@ jobs:
3030
name: Setup outputs
3131
run: ./.github/scripts/get_runner_classes.sh
3232

33+
get-go-version:
34+
uses: ./.github/workflows/reusable-get-go-version.yml
35+
3336
dev-build-push:
34-
needs: setup
37+
needs:
38+
- setup
39+
- get-go-version
3540
runs-on: ${{ fromJSON(needs.setup.outputs.compute-large) }}
3641
permissions:
3742
id-token: write # NOTE: this permission is explicitly required for Vault auth.
@@ -65,7 +70,7 @@ jobs:
6570

6671
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # pin@v3.5.0
6772
with:
68-
go-version-file: 'go.mod'
73+
go-version: ${{ needs.get-go-version.outputs.go-version }}
6974

7075
- run: go env
7176

.github/workflows/build-distros.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,25 @@ jobs:
3232
name: Setup outputs
3333
run: ./.github/scripts/get_runner_classes.sh
3434

35+
get-go-version:
36+
uses: ./.github/workflows/reusable-get-go-version.yml
37+
3538
check-go-mod:
3639
needs:
3740
- setup
41+
- get-go-version
3842
uses: ./.github/workflows/reusable-check-go-mod.yml
3943
with:
4044
runs-on: ${{ needs.setup.outputs.compute-medium }}
4145
repository-name: ${{ github.repository }}
46+
go-version: ${{ needs.get-go-version.outputs.go-version }}
4247
secrets:
4348
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
4449

4550
build-386:
4651
needs:
4752
- setup
53+
- get-go-version
4854
- check-go-mod
4955
env:
5056
XC_OS: "freebsd linux windows"
@@ -59,7 +65,7 @@ jobs:
5965

6066
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
6167
with:
62-
go-version-file: 'go.mod'
68+
go-version: ${{ needs.get-go-version.outputs.go-version }}
6369
- name: Build
6470
run: |
6571
for os in $XC_OS; do
@@ -69,6 +75,7 @@ jobs:
6975
build-amd64:
7076
needs:
7177
- setup
78+
- get-go-version
7279
- check-go-mod
7380
env:
7481
XC_OS: "darwin freebsd linux solaris windows"
@@ -83,7 +90,7 @@ jobs:
8390

8491
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
8592
with:
86-
go-version-file: 'go.mod'
93+
go-version: ${{ needs.get-go-version.outputs.go-version }}
8794
- name: Build
8895
run: |
8996
for os in $XC_OS; do
@@ -93,6 +100,7 @@ jobs:
93100
build-arm:
94101
needs:
95102
- setup
103+
- get-go-version
96104
- check-go-mod
97105
runs-on: ${{ fromJSON(needs.setup.outputs.compute-xl) }}
98106
env:
@@ -109,7 +117,7 @@ jobs:
109117

110118
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
111119
with:
112-
go-version-file: 'go.mod'
120+
go-version: ${{ needs.get-go-version.outputs.go-version }}
113121
- run: |
114122
sudo apt-get update --allow-releaseinfo-change-suite --allow-releaseinfo-change-version && sudo apt-get install -y gcc-arm-linux-gnueabi gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu
115123
@@ -122,6 +130,7 @@ jobs:
122130
if: ${{ endsWith(github.repository, '-enterprise') }}
123131
needs:
124132
- setup
133+
- get-go-version
125134
- check-go-mod
126135
runs-on: ${{ fromJSON(needs.setup.outputs.compute-xl) }}
127136
steps:
@@ -133,7 +142,7 @@ jobs:
133142

134143
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
135144
with:
136-
go-version-file: 'go.mod'
145+
go-version: ${{ needs.get-go-version.outputs.go-version }}
137146
- name: Build
138147
run: GOOS=linux GOARCH=s390x CGO_ENABLED=0 go build -tags "${{ env.GOTAGS }}"
139148

.github/workflows/build.yml

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ env:
1818
GOPRIVATE: github.com/hashicorp # Required for enterprise deps
1919

2020
jobs:
21+
get-go-version:
22+
uses: ./.github/workflows/reusable-get-go-version.yml
23+
2124
set-product-version:
2225
runs-on: ubuntu-latest
2326
outputs:
@@ -81,32 +84,25 @@ jobs:
8184
path: ${{ steps.generate-metadata-file.outputs.filepath }}
8285

8386
build:
84-
needs: set-product-version
87+
needs:
88+
- set-product-version
89+
- get-go-version
8590
runs-on: ubuntu-latest
8691
strategy:
8792
matrix:
8893
include:
89-
- {go: "1.20.12",
90-
goos: "linux", goarch: "386"}
91-
- {go: "1.20.12",
92-
goos: "linux", goarch: "amd64"}
93-
- {go: "1.20.12",
94-
goos: "linux", goarch: "arm"}
95-
- {go: "1.20.12",
96-
goos: "linux", goarch: "arm64"}
97-
- {go: "1.20.12",
98-
goos: "freebsd", goarch: "386"}
99-
- {go: "1.20.12",
100-
goos: "freebsd", goarch: "amd64"}
101-
- {go: "1.20.12",
102-
goos: "windows", goarch: "386"}
103-
- {go: "1.20.12",
104-
goos: "windows", goarch: "amd64"}
105-
- {go: "1.20.12",
106-
goos: "solaris", goarch: "amd64"}
94+
- {goos: "linux", goarch: "386"}
95+
- {goos: "linux", goarch: "amd64"}
96+
- {goos: "linux", goarch: "arm"}
97+
- {goos: "linux", goarch: "arm64"}
98+
- {goos: "freebsd", goarch: "386"}
99+
- {goos: "freebsd", goarch: "amd64"}
100+
- {goos: "windows", goarch: "386"}
101+
- {goos: "windows", goarch: "amd64"}
102+
- {goos: "solaris", goarch: "amd64"}
107103
fail-fast: true
108104

109-
name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} build
105+
name: Go ${{ needs.get-go-version.outputs.go-version }} ${{ matrix.goos }} ${{ matrix.goarch }} build
110106
steps:
111107
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
112108

@@ -140,7 +136,7 @@ jobs:
140136
with:
141137
product_name: ${{ env.PKG_NAME }}
142138
product_version: ${{ needs.set-product-version.outputs.product-version }}
143-
go_version: ${{ matrix.go }}
139+
go_version: ${{ needs.get-go-version.outputs.go-version }}
144140
os: ${{ matrix.goos }}
145141
arch: ${{ matrix.goarch }}
146142
reproducible: report
@@ -186,17 +182,18 @@ jobs:
186182
path: out/${{ env.DEB_PACKAGE }}
187183

188184
build-s390x:
189-
needs: set-product-version
185+
needs:
186+
- set-product-version
187+
- get-go-version
190188
if: ${{ endsWith(github.repository, '-enterprise') }}
191189
runs-on: ubuntu-latest
192190
strategy:
193191
matrix:
194192
include:
195-
- {go: "1.20.12",
196-
goos: "linux", goarch: "s390x"}
193+
- {goos: "linux", goarch: "s390x"}
197194
fail-fast: true
198195

199-
name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} build
196+
name: Go ${{ needs.get-go-version.outputs.go-version }} ${{ matrix.goos }} ${{ matrix.goarch }} build
200197
steps:
201198
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
202199

@@ -230,24 +227,25 @@ jobs:
230227
with:
231228
product_name: ${{ env.PKG_NAME }}
232229
product_version: ${{ needs.set-product-version.outputs.product-version }}
233-
go_version: ${{ matrix.go }}
230+
go_version: ${{ needs.get-go-version.outputs.go-version }}
234231
os: ${{ matrix.goos }}
235232
arch: ${{ matrix.goarch }}
236233
reproducible: report
237234
instructions: |-
238235
go build -ldflags="$GOLDFLAGS" -o "$BIN_PATH" -trimpath -buildvcs=false
239236
240237
build-darwin:
241-
needs: set-product-version
238+
needs:
239+
- set-product-version
240+
- get-go-version
242241
runs-on: macos-latest
243242
strategy:
244243
matrix:
245244
goos: [ darwin ]
246245
goarch: [ "amd64", "arm64" ]
247-
go: [ "1.20.12" ]
248246
fail-fast: true
249247

250-
name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} build
248+
name: Go ${{ needs.get-go-version.outputs.go-version }} ${{ matrix.goos }} ${{ matrix.goarch }} build
251249
steps:
252250
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
253251

@@ -279,7 +277,7 @@ jobs:
279277
with:
280278
product_name: ${{ env.PKG_NAME }}
281279
product_version: ${{ needs.set-product-version.outputs.product-version }}
282-
go_version: ${{ matrix.go }}
280+
go_version: ${{ needs.get-go-version.outputs.go-version }}
283281
os: ${{ matrix.goos }}
284282
arch: ${{ matrix.goarch }}
285283
reproducible: report

0 commit comments

Comments
 (0)