Skip to content

Commit 52e98fb

Browse files
authored
Merge branch 'main' into fix/enforce-keyless-verification
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>
2 parents 2e1ffbd + 524c113 commit 52e98fb

79 files changed

Lines changed: 4892 additions & 1798 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.chainloop.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ organization: chainloop
44
projectName: chainloop
55
# This indicates the [current version]+next
66
# to indicate that we are building a new version of the project
7-
projectVersion: v1.115.0+next
7+
projectVersion: v1.117.0+next
88

99
# Experimental feature used by Chainloop labs shared workflow https://github.com/chainloop-dev/labs
1010
# It maps the material names with location in disk so they get automatically attested

‎.claude/skills/upgrading-golang/SKILL.md‎

Lines changed: 47 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: upgrading-golang
3-
description: Upgrades Go version across the entire Chainloop codebase including source files, Docker images, CI/CD workflows, and documentation. Use when the user mentions upgrading Go, golang version, or updating Go compiler version.
3+
description: Upgrades Go version across the entire Chainloop codebase including source files, Docker images, golangci-lint, CI/CD workflows, and documentation. Use when the user mentions upgrading Go, golang version, or updating Go compiler version, or when CI lint fails because golangci-lint was built with an older Go than the one targeted in go.mod.
44
---
55

66
# Upgrading Golang Version
@@ -12,7 +12,7 @@ This skill automates the comprehensive Go version upgrade process across all com
1212
### 1. Confirm Target Versions
1313

1414
Ask the user:
15-
1. What Go version they want to upgrade to (e.g., "1.25.3")
15+
1. What Go version they want to upgrade to (e.g., "1.25.3"). If they give only a minor version (e.g., "1.27"), use the latest patch from `curl -s 'https://go.dev/dl/?mode=json'`.
1616
2. Whether they also want to upgrade Atlas migrations Docker image (if yes, ask for target Atlas version, e.g., "0.38.0")
1717

1818
### 2. Get Docker Image Digest
@@ -25,6 +25,16 @@ docker pull golang:X.XX.X
2525

2626
Extract the SHA256 digest from the output (format: `sha256:abc123...`).
2727

28+
If the Docker daemon is not running, read the multi-arch index digest from the registry instead:
29+
30+
```bash
31+
TOKEN=$(curl -s "https://auth.docker.io/token?service=registry.docker.io&scope=repository:library/golang:pull" | jq -r .token)
32+
curl -sI -H "Authorization: Bearer $TOKEN" \
33+
-H "Accept: application/vnd.oci.image.index.v1+json" \
34+
-H "Accept: application/vnd.docker.distribution.manifest.list.v2+json" \
35+
https://registry-1.docker.io/v2/library/golang/manifests/X.XX.X | grep -i docker-content-digest
36+
```
37+
2838
### 3. Update Source Code
2939

3040
Update the `go` directive in:
@@ -37,6 +47,8 @@ Pattern to replace:
3747
go X.XX.X
3848
```
3949

50+
Then run `go mod tidy` and `go build ./...`.
51+
4052
### 4. Update Docker Images
4153

4254
Update all Dockerfiles with the new version and SHA256 digest. See [files-to-update.md](files-to-update.md) for the complete list.
@@ -51,26 +63,50 @@ With:
5163
FROM golang:X.XX.X@sha256:NEW_DIGEST AS builder
5264
```
5365

54-
### 5. Update Documentation
66+
### 5. Update golangci-lint
67+
68+
golangci-lint refuses to run when it was built with a Go version older than the `go` directive in `go.mod` ("the Go language version (goX.YY) used to build golangci-lint is lower than the targeted Go version"). On a Go minor upgrade, bump it to a release that supports the new Go version.
69+
70+
1. Find the first golangci-lint release that adds support for the new Go minor (its changelog has a "goX.YY support" entry): `gh release list -R golangci/golangci-lint`. Prefer the latest release.
71+
2. Update every `version:` of `golangci/golangci-lint-action` in `.github/workflows/lint.yml`.
72+
3. Update the install version in the `init` target of `./common.mk` to the same version.
73+
4. Verify locally the way CI runs it (CI uses `only-new-issues`), from the repo root and from `app/cli`, `app/controlplane` and `app/artifact-cas`:
74+
75+
```bash
76+
GOBIN=<scratch-dir> go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@vX.Y.Z
77+
<scratch-dir>/golangci-lint run --new-from-rev=<upstream>/main
78+
```
79+
80+
For a Go patch upgrade, the golangci-lint bump is not required.
81+
82+
### 5b. Regenerate Protobuf Code
83+
84+
The protoc plugins (`protoc-gen-go`, etc.) format their output with the `go/format` of the Go toolchain that built them. A new Go minor can change how comments in generated `.pb.go` files are formatted, and the CI `Test (main-module)` job fails with "The Git repository is dirty" when the committed files do not match.
85+
86+
1. Rebuild the codegen tools with the new Go: `make init-api-tools`.
87+
2. Run `make api` (the openapi step needs Docker running) and `make config`.
88+
3. Commit the regenerated `.pb.go` files. The changes are expected to be comment-only; investigate anything else.
89+
90+
### 6. Update Documentation
5591

5692
Update the version reference in `./CLAUDE.md` under "Key Technologies":
5793
```markdown
58-
- **Language**: Go X.XX.X. To know how to upgrade go version, see docs/runbooks
94+
- **Language**: Go X.XX.X
5995
```
6096

61-
### 6. Update Atlas Docker Image and CLI (Optional)
97+
### 7. Update Atlas Docker Image and CLI (Optional)
6298

6399
If the user requested an Atlas upgrade:
64100

65-
**6a. Pull the Atlas Docker image and extract its SHA256 digest:**
101+
**7a. Pull the Atlas Docker image and extract its SHA256 digest:**
66102

67103
```bash
68104
docker pull arigaio/atlas:X.XX.X
69105
```
70106

71107
Extract the SHA256 digest from the output (format: `sha256:abc123...`).
72108

73-
**6b. Update `./app/controlplane/Dockerfile.migrations`:**
109+
**7b. Update `./app/controlplane/Dockerfile.migrations`:**
74110

75111
Pattern to replace:
76112
```dockerfile
@@ -100,17 +136,11 @@ If the command fails or the version is not available, do NOT update common.mk. O
100136

101137
Update the Atlas CLI installation version in the `init` target:
102138

103-
Pattern to replace:
104-
```makefile
105-
curl -sSf https://atlasgo.sh | ATLAS_VERSION=vX.XX.X sh -s -- -y
106-
```
107-
108-
With the new version (note: use `v` prefix for the version):
109139
```makefile
110140
curl -sSf https://atlasgo.sh | ATLAS_VERSION=vX.XX.X sh -s -- -y
111141
```
112142

113-
### 7. Verify Changes
143+
### 8. Verify Changes
114144

115145
Run verification commands:
116146
```bash
@@ -120,8 +150,9 @@ make lint
120150

121151
If errors occur, address them before completing the upgrade.
122152

123-
### 8. Final Checks
153+
### 9. Final Checks
124154

155+
- Search for leftover references to the old version: `grep -rnE "golang:OLD|go OLD|OLD_MINOR\.[0-9]" --exclude=go.sum .`
125156
- Ensure all license headers are updated (2024 → 2024-2025 or add current year)
126157
- Run `buf format -w` if any proto files were affected
127158
- Run `wire ./...` if any constructor dependencies changed
@@ -131,5 +162,6 @@ If errors occur, address them before completing the upgrade.
131162

132163
- Always use SHA256 digests for Docker images for security and reproducibility
133164
- The dagger module (`./extras/dagger/go.mod`) must NOT be updated
165+
- GitHub Actions workflows read the Go version from `go.mod` (`go-version-file`), so they need no change for Go itself
134166
- Test thoroughly as Go upgrades can introduce breaking changes
135167
- Multiple components use Go: CLI, Control Plane, and Artifact CAS

‎.claude/skills/upgrading-golang/files-to-update.md‎

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ This reference lists all files that must be updated when upgrading Go versions.
1313
## Docker Images
1414

1515
### Dockerfiles (Golang)
16-
- `./app/artifact-cas/Dockerfile`
1716
- `./app/artifact-cas/Dockerfile.goreleaser`
18-
- `./app/controlplane/Dockerfile`
1917
- `./app/controlplane/Dockerfile.goreleaser`
2018
- `./app/cli/Dockerfile.goreleaser`
2119

@@ -24,6 +22,17 @@ Update pattern in all:
2422
FROM golang:X.XX.X@sha256:DIGEST AS builder
2523
```
2624

25+
## golangci-lint (Go minor upgrades)
26+
27+
- `./.github/workflows/lint.yml` - every `version:` of `golangci/golangci-lint-action` (main module, apps, and dagger module jobs)
28+
- `./common.mk` - golangci-lint install version in the `init` target
29+
30+
Keep both on the same golangci-lint version.
31+
32+
## GitHub Actions
33+
34+
No change needed for Go itself: `test.yml`, `lint.yml`, `release.yaml` and `codeql.yml` use `go-version-file: 'go.mod'`.
35+
2736
### Atlas Files (Optional)
2837
- `./app/controlplane/Dockerfile.migrations` - Docker image for migrations
2938
- `./common.mk` - CLI tool installation in `make init`
@@ -48,18 +57,20 @@ curl -sSf https://atlasgo.sh | ATLAS_VERSION=vX.XX.X sh -s -- -y
4857
### Project Documentation
4958
- `./CLAUDE.md` - Update "Key Technologies" section:
5059
```markdown
51-
- **Language**: Go X.XX.X. To know how to upgrade go version, see docs/runbooks
60+
- **Language**: Go X.XX.X
5261
```
5362

5463
## Summary
5564

56-
**Total files to update for Go**: 13 files
65+
**Files to update for Go**: 5 files
5766
- 1 go.mod file
58-
- 5 Dockerfiles (Golang)
59-
- 5 GitHub Actions workflows
60-
- 1 example workflow
67+
- 3 Dockerfiles (Golang)
6168
- 1 documentation file
6269

70+
**golangci-lint (Go minor upgrades)**: 2 files
71+
- 1 GitHub Actions workflow (lint.yml)
72+
- 1 Makefile (common.mk)
73+
6374
**Optional Atlas upgrade**: 2 files
6475
- 1 Dockerfile (Atlas migrations)
6576
- 1 Makefile (Atlas CLI in make init)

‎.github/workflows/lint.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ jobs:
3737
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
3838
if: ${{ matrix.app == 'main-module' }}
3939
with:
40-
version: v2.9.0
40+
version: v2.14.0
4141
only-new-issues: 'true'
4242

4343
- name: Lint ${{ matrix.app }}
4444
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
4545
if: ${{ matrix.app != 'main-module' }}
4646
with:
4747
working-directory: app/${{ matrix.app }}
48-
version: v2.9.0
48+
version: v2.14.0
4949
only-new-issues: 'true'
5050

5151
lint-protos:
@@ -87,5 +87,5 @@ jobs:
8787
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
8888
with:
8989
working-directory: extras/dagger
90-
version: v2.9.0
90+
version: v2.14.0
9191
only-new-issues: 'true'

0 commit comments

Comments
 (0)