Skip to content

Commit e42f7b7

Browse files
cpanatopuerco
andauthored
introduce dockerfile to keep the go to use in ci up-to-date and ci cleanup (#300)
* introduce dockerfile to keep the go to use in ci up-to-date Signed-off-by: Carlos Panato <[email protected]> * set go from the dockerfile and apply best practices Signed-off-by: Carlos Panato <[email protected]> * apply best practices Signed-off-by: Carlos Panato <[email protected]> * Run commands with context Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]> --------- Signed-off-by: Carlos Panato <[email protected]> Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]> Co-authored-by: Adolfo García Veytia (Puerco) <[email protected]>
1 parent f4fa9cc commit e42f7b7

File tree

8 files changed

+61
-21
lines changed

8 files changed

+61
-21
lines changed

.github/dependabot.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,13 @@ updates:
2323
update-types:
2424
- "minor"
2525
- "patch"
26+
27+
- package-ecosystem: "docker"
28+
directory: "/"
29+
schedule:
30+
interval: "weekly"
31+
groups:
32+
all:
33+
update-types:
34+
- "minor"
35+
- "patch"

.github/workflows/compute_slsa_source.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@ name: "Computes the SLSA source information"
33
on:
44
workflow_call:
55

6+
permissions: {}
7+
68
jobs:
79
compute_slsa_source:
10+
runs-on: ubuntu-latest
11+
812
permissions:
913
contents: write # needed for storing attestations in the repo
1014
id-token: write
11-
runs-on: ubuntu-latest
15+
1216
steps:
1317
- name: prov
1418
uses: slsa-framework/slsa-source-poc/actions/slsa_with_provenance@main

.github/workflows/go-test.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,33 @@ name: Go Tests (sourcetool)
55

66
on:
77
pull_request:
8+
branches:
9+
- main
10+
11+
permissions: {}
812

913
jobs:
1014
test:
15+
runs-on: ubuntu-latest
16+
1117
permissions:
1218
contents: read
13-
runs-on: ubuntu-latest
19+
1420
steps:
1521
- name: Checkout code
1622
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1723
with:
1824
persist-credentials: false
1925

26+
- name: Extract version of Go to use
27+
run: echo "GOVERSION=$(awk -F'[:@]' '/FROM golang/{print $2; exit}' Dockerfile)" >> $GITHUB_ENV
28+
2029
- name: Set up Go
2130
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
2231
with:
23-
go-version-file: go.mod
32+
go-version: ${{ env.GOVERSION }}
2433
check-latest: true
34+
cache: false
2535

2636
- name: Setup Buf
2737
uses: bufbuild/buf-setup-action@a47c93e0b1648d5651a065437926377d060baa99 # v1.50.0
@@ -31,7 +41,7 @@ jobs:
3141

3242
- name: Run Go tests
3343
run: |
34-
go test ./...
44+
go test -v ./...
3545
3646
- name: Check generated fakes
3747
run: |

.github/workflows/golangci-lint.yaml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,28 @@ on:
99
branches:
1010
- main
1111

12-
permissions:
13-
contents: read
12+
permissions: {}
1413

1514
jobs:
1615
golangci:
1716
name: lint
1817
runs-on: ubuntu-latest
18+
19+
permissions:
20+
contents: read
21+
1922
steps:
2023
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2124
with:
2225
persist-credentials: false
2326

27+
- name: Extract version of Go to use
28+
run: echo "GOVERSION=$(awk -F'[:@]' '/FROM golang/{print $2; exit}' Dockerfile)" >> $GITHUB_ENV
29+
2430
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
2531
with:
26-
go-version-file: go.mod
32+
go-version: ${{ env.GOVERSION }}
33+
check-latest: true
2734
cache: false
2835

2936
- run: |
@@ -32,5 +39,4 @@ jobs:
3239
- name: Run golangci-lint
3340
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
3441
with:
35-
version: v2.1
36-
42+
version: v2.4

.github/workflows/local_attest.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44
name: SLSA Source
55
on:
66
push:
7-
branches: [ "main" ]
8-
tags: ['**']
7+
branches:
8+
- main
9+
tags:
10+
- '**'
11+
12+
permissions: {}
913

1014
jobs:
1115
# Whenever new source is pushed recompute the slsa source information.

.github/workflows/release.yaml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ on:
77
push:
88
tags:
99
- 'v*'
10-
permissions:
11-
contents: read
12-
10+
11+
permissions: {}
12+
1313
jobs:
1414
release:
1515
runs-on: ubuntu-latest
@@ -18,9 +18,9 @@ jobs:
1818
id-token: write # To sign attestations
1919
attestations: write # To push build provenance to attestations store
2020
contents: write # To create the release
21-
21+
2222
steps:
23-
23+
2424
- name: Setup bnd
2525
uses: carabiner-dev/actions/install/bnd@HEAD
2626

@@ -30,9 +30,13 @@ jobs:
3030
persist-credentials: false
3131
fetch-depth: 1
3232

33+
- name: Extract version of Go to use
34+
run: echo "GOVERSION=$(awk -F'[:@]' '/FROM golang/{print $2; exit}' Dockerfile)" >> $GITHUB_ENV
35+
3336
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
3437
with:
35-
go-version-file: go.mod
38+
go-version: ${{ env.GOVERSION }}
39+
check-latest: true
3640
cache: false
3741

3842
- name: Install tejolote
@@ -43,7 +47,7 @@ jobs:
4347
- name: Set tag output
4448
id: tag
4549
run: echo "tag_name=${GITHUB_REF#refs/*/}" >> "$GITHUB_OUTPUT"
46-
50+
4751
- name: Run GoReleaser
4852
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
4953
id: goreleaser
@@ -67,5 +71,4 @@ jobs:
6771
bnd pack attestations/ > sourcetool.intoto.jsonl
6872
gh release upload ${{ steps.tag.outputs.tag_name }} sourcetool.intoto.jsonl
6973
# Remove this once GitHub like the tejolote build predicate
70-
# bnd push github ${{github.repository}} attestations/sourcetool-${{ steps.tag.outputs.tag_name }}.provenance.json
71-
74+
# bnd push github ${{github.repository}} attestations/sourcetool-${{ steps.tag.outputs.tag_name }}.provenance.json

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This is used to we scrap the go version and use in CI to get the latest go version
2+
# and we use dependabot to keep the go version up to date
3+
FROM golang:1.25.0

pkg/auth/implementation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func (di *defaultImplementation) openBrowser(authURL string) error {
112112
cmd = "xdg-open"
113113
}
114114

115-
return exec.Command(cmd, append(args, authURL)...).Start() //nolint:gosec // yes variable input
115+
return exec.CommandContext(context.Background(), cmd, append(args, authURL)...).Start() //nolint:gosec // yes variable input
116116
}
117117

118118
// requestDeviceCode requests a device code from GitHub

0 commit comments

Comments
 (0)