|
| 1 | +# Go Version Upgrade Process |
| 2 | + |
| 3 | +This document outlines the comprehensive process for upgrading Go versions across the Chainloop project. |
| 4 | + |
| 5 | +NOTE |
| 6 | + |
| 7 | +- do not upgrade dagger module |
| 8 | + |
| 9 | +## Overview |
| 10 | + |
| 11 | +The Chainloop project uses Go in multiple components requiring updates across: |
| 12 | +- Source code (go.mod files) |
| 13 | +- Docker images |
| 14 | +- CI/CD pipelines (GitHub Actions) |
| 15 | +- Documentation |
| 16 | + |
| 17 | +## Step-by-Step Process |
| 18 | + |
| 19 | +### 1. Get Latest Go Version and Docker Image Digest |
| 20 | + |
| 21 | +```bash |
| 22 | +# Check latest Go version at https://go.dev/doc/devel/release |
| 23 | +# Get Docker image SHA256 digest |
| 24 | +docker pull golang:1.24.6 |
| 25 | +# Note the SHA256 from output: sha256:2c89c41fb9efc3807029b59af69645867cfe978d2b877d475be0d72f6c6ce6f6 |
| 26 | +``` |
| 27 | + |
| 28 | +### 2. Update Source Code |
| 29 | + |
| 30 | +Update all `go.mod` files in the project: |
| 31 | +- `./go.mod` - Main project |
| 32 | +- `./extras/dagger/go.mod` - Dagger module |
| 33 | + |
| 34 | +Change the `go` directive to new version: |
| 35 | +```go |
| 36 | +go 1.24.6 |
| 37 | +``` |
| 38 | + |
| 39 | +### 3. Update Docker Images |
| 40 | + |
| 41 | +Update all Dockerfiles with new version and SHA256: |
| 42 | +- `./app/artifact-cas/Dockerfile` |
| 43 | +- `./app/artifact-cas/Dockerfile.goreleaser` |
| 44 | +- `./app/controlplane/Dockerfile` |
| 45 | +- `./app/controlplane/Dockerfile.goreleaser` |
| 46 | +- `./app/cli/Dockerfile.goreleaser` |
| 47 | + |
| 48 | +Replace `FROM` lines with: |
| 49 | +```dockerfile |
| 50 | +FROM golang:1.24.6@sha256:2c89c41fb9efc3807029b59af69645867cfe978d2b877d475be0d72f6c6ce6f6 AS builder |
| 51 | +``` |
| 52 | + |
| 53 | +### 4. Update GitHub Actions |
| 54 | + |
| 55 | +Update go-version in all workflow files: |
| 56 | +- `./.github/workflows/lint.yml` |
| 57 | +- `./.github/workflows/test.yml` |
| 58 | +- `./.github/workflows/release.yaml` |
| 59 | +- `./.github/workflows/codeql.yml` |
| 60 | +- `./docs/examples/ci-workflows/github.yaml` |
| 61 | + |
| 62 | +Find and replace: |
| 63 | +```yaml |
| 64 | +go-version: "1.24.4" # old version |
| 65 | +``` |
| 66 | +with: |
| 67 | +```yaml |
| 68 | +go-version: "1.24.6" # new version |
| 69 | +``` |
| 70 | +
|
| 71 | +### 5. Update Documentation |
| 72 | +
|
| 73 | +Update version reference in `./CLAUDE.md` - "Key Technologies" section: |
| 74 | +```markdown |
| 75 | +- **Language**: Go 1.24.6 |
| 76 | +``` |
| 77 | + |
| 78 | +### 6. Test and Verify |
| 79 | + |
| 80 | +```bash |
| 81 | +make test # Ensure compatibility |
| 82 | +make lint # Check code quality |
| 83 | +``` |
| 84 | + |
| 85 | +## Important Notes |
| 86 | + |
| 87 | +1. **SHA256 Verification**: Always use SHA256 digests for Docker images for security and reproducibility |
| 88 | +2. **Test Thoroughly**: Go upgrades can introduce breaking changes |
| 89 | +3. **Multiple Components**: CLI, Control Plane, and Artifact CAS all use Go |
| 90 | +4. **Dagger Module**: Has separate go.mod that needs updating |
| 91 | +5. **Development Environment**: Compose files use pre-built images, don't need Go updates |
| 92 | + |
| 93 | +## Files Updated in This Process |
| 94 | + |
| 95 | +### Source Code |
| 96 | +- `./go.mod` |
| 97 | + |
| 98 | +### Docker Images |
| 99 | +- `./app/artifact-cas/Dockerfile` |
| 100 | +- `./app/artifact-cas/Dockerfile.goreleaser` |
| 101 | +- `./app/controlplane/Dockerfile` |
| 102 | +- `./app/controlplane/Dockerfile.goreleaser` |
| 103 | +- `./app/cli/Dockerfile.goreleaser` |
| 104 | + |
| 105 | +### CI/CD Workflows |
| 106 | +- `./.github/workflows/lint.yml` |
| 107 | +- `./.github/workflows/test.yml` |
| 108 | +- `./.github/workflows/release.yaml` |
| 109 | +- `./.github/workflows/codeql.yml` |
| 110 | +- `./docs/examples/ci-workflows/github.yaml` |
| 111 | + |
| 112 | +### Documentation |
| 113 | +- `./CLAUDE.md` |
0 commit comments