Skip to content

Commit e353b79

Browse files
authored
chore: use latest and centrally manage Go version (#724)
1 parent c15a236 commit e353b79

4 files changed

Lines changed: 62 additions & 59 deletions

File tree

.github/workflows/docker.yml

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ on:
3333
kosli_api_token:
3434
required: true
3535
snyk_token:
36-
required: true
36+
required: true
3737

3838

3939
env:
@@ -43,7 +43,7 @@ env:
4343
# this interferes with the CLI integration tests
4444

4545

46-
jobs:
46+
jobs:
4747
docker:
4848
name: Docker Build
4949
runs-on: ubuntu-latest
@@ -61,7 +61,8 @@ jobs:
6161

6262
- uses: actions/setup-go@v5
6363
with:
64-
go-version: '1.25.0'
64+
go-version-file: '.go-version'
65+
check-latest: true
6566

6667
# Set up QEMU emulator to allow building multi-arch images
6768
- name: Set up QEMU
@@ -76,15 +77,15 @@ jobs:
7677
with:
7778
version:
7879
${{ vars.KOSLI_CLI_VERSION }}
79-
80+
8081
- name: Login to GitHub Container Registry
8182
uses: docker/login-action@v3
8283
with:
8384
registry: ghcr.io
8485
username: ${{ github.actor }}
8586
password: ${{ secrets.GITHUB_TOKEN }}
8687

87-
# Push image to the GHCR
88+
# Push image to the GHCR
8889
- name: Build and push Docker image
8990
id: docker_build
9091
uses: docker/build-push-action@v5
@@ -127,7 +128,7 @@ jobs:
127128
subject-digest: ${{ steps.docker_build.outputs.digest }}
128129
push-to-registry: true
129130

130-
131+
131132
- name: setup Snyk
132133
uses: snyk/actions/setup@master
133134

@@ -136,36 +137,36 @@ jobs:
136137
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
137138
env:
138139
KOSLI_API_TOKEN: ${{ secrets.kosli_api_token }}
139-
run:
140+
run:
140141
kosli attest artifact
141142
${{ env.IMAGE }}:${{ inputs.tag }}
142-
--flow ${{ inputs.flow_name }}
143-
--trail ${{ inputs.trail_name }}
143+
--flow ${{ inputs.flow_name }}
144+
--trail ${{ inputs.trail_name }}
144145
--name cli-docker
145146
--fingerprint ${{ env.FINGERPRINT }}
146147
--external-url sigstore=https://search.sigstore.dev/?hash=${{ env.FINGERPRINT }}
147148
--org ${{ inputs.kosli_org }}
148149

149-
150+
150151
- name: Report SBOM to Kosli
151152
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
152153
env:
153154
KOSLI_API_TOKEN: ${{ secrets.kosli_api_token }}
154-
run:
155+
run:
155156
kosli attest generic
156157
--flow ${{ inputs.flow_name }}
157-
--trail ${{ inputs.trail_name }}
158+
--trail ${{ inputs.trail_name }}
158159
--name container-sbom
159160
--fingerprint ${{ env.FINGERPRINT }}
160161
--attachments sbom.spdx.json
161162
--org ${{ inputs.kosli_org }}
162163

163-
164+
164165
- name: Run Snyk Container Test to scan the Docker image for vulnerabilities
165166
env:
166167
SNYK_TOKEN: ${{ secrets.snyk_token }}
167-
run:
168-
snyk container test ${{ env.IMAGE }}:${{ inputs.tag }}
168+
run:
169+
snyk container test ${{ env.IMAGE }}:${{ inputs.tag }}
169170
--file=Dockerfile
170171
--sarif
171172
--policy-path=.snyk
@@ -176,11 +177,11 @@ jobs:
176177
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') && (success() || failure()) }}
177178
env:
178179
KOSLI_API_TOKEN: ${{ secrets.kosli_api_token }}
179-
run:
180-
kosli attest snyk
180+
run:
181+
kosli attest snyk
181182
--flow ${{ inputs.flow_name }}
182-
--trail ${{ inputs.trail_name }}
183-
--fingerprint ${{ env.FINGERPRINT }}
183+
--trail ${{ inputs.trail_name }}
184+
--fingerprint ${{ env.FINGERPRINT }}
184185
--name snyk-container-test
185186
--scan-results snyk-docker.json
186187
--org ${{ inputs.kosli_org }}
@@ -191,7 +192,7 @@ jobs:
191192
env:
192193
KOSLI_ORG: cyber-dojo
193194
KOSLI_API_TOKEN: any-token-will-do
194-
run:
195+
run:
195196
docker run -e KOSLI_API_TOKEN
196197
-e KOSLI_ORG --rm ${{ env.IMAGE }}:${{ inputs.tag }}
197198
list environments
@@ -201,12 +202,12 @@ jobs:
201202
env:
202203
KOSLI_API_TOKEN: ${{ secrets.kosli_api_token }}
203204
SMOKE_TEST_OUTCOME: ${{ steps.smoke-test.outcome}}
204-
run:
205-
kosli attest generic
205+
run:
206+
kosli attest generic
206207
--flow ${{ inputs.flow_name }}
207-
--trail ${{ inputs.trail_name }}
208-
--fingerprint ${{ env.FINGERPRINT }}
208+
--trail ${{ inputs.trail_name }}
209+
--fingerprint ${{ env.FINGERPRINT }}
209210
--name smoke-test
210-
--compliant=${{ steps.smoke-test.outcome == 'success' }}
211+
--compliant=${{ steps.smoke-test.outcome == 'success' }}
211212
--org ${{ inputs.kosli_org }}
212213

.github/workflows/release.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ on:
55
tags:
66
- "v*"
77

8-
env:
9-
GO_VERSION: 1.25.0
10-
118
concurrency:
129
group: ${{ github.workflow }}-${{ github.ref }}
1310

@@ -121,7 +118,8 @@ jobs:
121118
- name: Set up Go
122119
uses: actions/setup-go@v5
123120
with:
124-
go-version: ${{ env.GO_VERSION }}
121+
go-version-file: '.go-version'
122+
check-latest: true
125123

126124
# Use release notes from the tag body when present (set by interactive `make release` or `make release tag=vX.Y.Z` with dist/release_notes.md). Otherwise GoReleaser uses its default changelog.
127125
# Write to repo root so GoReleaser's --clean (which removes dist/) does not delete the file before it is read.
@@ -207,14 +205,15 @@ jobs:
207205
- name: Set up Go
208206
uses: actions/setup-go@v5
209207
with:
210-
go-version: ${{ env.GO_VERSION }}
208+
go-version-file: '.go-version'
209+
check-latest: true
211210

212211
- name: Generate docs
213212
env:
214213
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
215214
# legacy-ref should happen first as it has the side effect of deleting generated files outside the legacy_ref
216215
run: |
217-
make legacy-ref-docs
216+
make legacy-ref-docs
218217
make cli-docs
219218
220219
- name: Generate json
@@ -302,4 +301,4 @@ jobs:
302301
uses: kosli-dev/reusable-actions/.github/actions/send-ci-failure-slack-message@main
303302
with:
304303
slack_url: ${{ secrets.MERKELY_SLACK_CI_FAILURES_WEBHOOK }}
305-
github_token: ${{ secrets.GITHUB_TOKEN }}
304+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ on:
4242
github_access_token:
4343
required: true
4444
gitlab_access_token:
45-
required: true
45+
required: true
4646
azure_access_token:
47-
required: true
47+
required: true
4848
azure_client_id:
4949
required: true
5050
azure_client_secret:
5151
required: true
5252
bitbucket_access_token:
5353
required: true
5454
jira_api_token:
55-
required: true
55+
required: true
5656
snyk_token:
5757
required: true
5858
kosli_reporting_api_token:
@@ -79,7 +79,8 @@ jobs:
7979

8080
- uses: actions/setup-go@v5
8181
with:
82-
go-version: '1.25.0'
82+
go-version-file: '.go-version'
83+
check-latest: true
8384

8485
- name: setup-kosli-cli
8586
uses: kosli-dev/setup-cli-action@v2
@@ -98,10 +99,10 @@ jobs:
9899
if: ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) && (success() || failure()) && inputs.report_results }}
99100
env:
100101
KOSLI_API_TOKEN: ${{ secrets.kosli_reporting_api_token }}
101-
run: kosli attest generic
102-
--name lint
103-
--flow ${{ inputs.FLOW_NAME }}
104-
--trail ${{ inputs.TRAIL_NAME }}
102+
run: kosli attest generic
103+
--name lint
104+
--flow ${{ inputs.FLOW_NAME }}
105+
--trail ${{ inputs.TRAIL_NAME }}
105106
--org ${{ inputs.KOSLI_ORG }}
106107
--compliant=${{ steps.lint.outcome == 'success' }}
107108

@@ -112,15 +113,16 @@ jobs:
112113
id-token: write
113114
contents: write
114115
steps:
115-
116+
116117
- uses: actions/checkout@v6
117118
with:
118119
fetch-depth: 0 # needed for some tests referencing older commits
119120
ref: ${{ inputs.checkout_ref || github.sha }}
120-
121+
121122
- uses: actions/setup-go@v5
122123
with:
123-
go-version: '1.25.0'
124+
go-version-file: '.go-version'
125+
check-latest: true
124126

125127
- name: setup-kosli-cli
126128
uses: kosli-dev/setup-cli-action@v2
@@ -163,10 +165,10 @@ jobs:
163165
if: ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) && (success() || failure()) && inputs.report_results }}
164166
env:
165167
KOSLI_API_TOKEN: ${{ secrets.kosli_reporting_api_token }}
166-
run: kosli attest junit
167-
--name test
168-
--flow ${{ inputs.FLOW_NAME }}
169-
--trail ${{ inputs.TRAIL_NAME }}
168+
run: kosli attest junit
169+
--name test
170+
--flow ${{ inputs.FLOW_NAME }}
171+
--trail ${{ inputs.TRAIL_NAME }}
170172
--results-dir junit-test-results
171173
--org ${{ inputs.KOSLI_ORG }}
172174

@@ -199,17 +201,17 @@ jobs:
199201
- name: Run Snyk to check source code for vulnerabilities
200202
env:
201203
SNYK_TOKEN: ${{ secrets.snyk_token }}
202-
run:
204+
run:
203205
snyk code test --sarif --policy-path=.snyk --sarif-file-output=snyk-code.json --prune-repeated-subdependencies
204-
206+
205207
- name: Report Snyk Code to Kosli
206208
if: ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) && (success() || failure()) && inputs.report_results }}
207209
env:
208210
KOSLI_API_TOKEN: ${{ secrets.kosli_reporting_api_token }}
209-
run: kosli attest snyk
210-
--name snyk-code-test
211-
--flow ${{ inputs.FLOW_NAME }}
212-
--trail ${{ inputs.TRAIL_NAME }}
211+
run: kosli attest snyk
212+
--name snyk-code-test
213+
--flow ${{ inputs.FLOW_NAME }}
214+
--trail ${{ inputs.TRAIL_NAME }}
213215
--scan-results snyk-code.json
214216
--org ${{ inputs.KOSLI_ORG }}
215217

@@ -238,17 +240,17 @@ jobs:
238240
- name: Run Snyk to check dependencies for vulnerabilities
239241
env:
240242
SNYK_TOKEN: ${{ secrets.snyk_token }}
241-
run:
243+
run:
242244
snyk test --sarif --policy-path=.snyk --sarif-file-output=snyk-dependency.json --prune-repeated-subdependencies
243-
245+
244246
- name: Report Snyk Test to Kosli
245247
if: ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) && (success() || failure()) && inputs.report_results }}
246248
env:
247249
KOSLI_API_TOKEN: ${{ secrets.kosli_reporting_api_token }}
248-
run: kosli attest snyk
249-
--name snyk-dependency-test
250-
--flow ${{ inputs.FLOW_NAME }}
251-
--trail ${{ inputs.TRAIL_NAME }}
250+
run: kosli attest snyk
251+
--name snyk-dependency-test
252+
--flow ${{ inputs.FLOW_NAME }}
253+
--trail ${{ inputs.TRAIL_NAME }}
252254
--scan-results snyk-dependency.json
253255
--org ${{ inputs.KOSLI_ORG }}
254256

.go-version

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

0 commit comments

Comments
 (0)