ci: use go.mod as source of truth for actions/setup-go action (#87574)

* ci: use go.mod as source of truth for actions/setup-go action

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

* updating upgrading-go-version.md doc

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>

---------

Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
This commit is contained in:
Dave Henderson 2024-05-09 20:30:13 +01:00 committed by GitHub
parent 49cd917b08
commit c6a0175c04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 14 additions and 16 deletions

View File

@ -16,7 +16,7 @@ jobs:
- name: Set go version
uses: actions/setup-go@v4
with:
go-version: '1.22.3'
go-version-file: go.mod
- name: Build swagger
run: |
make -C pkg/services/ngalert/api/tooling post.json api.json

View File

@ -58,7 +58,7 @@ jobs:
# Go is required for also updating the schema versions as part of the precommit hook:
- uses: actions/setup-go@v4
with:
go-version: '1.22.3'
go-version-file: go.mod
- uses: actions/setup-node@v4
with:
node-version: '18'

View File

@ -48,7 +48,7 @@ jobs:
name: Set go version
uses: actions/setup-go@v4
with:
go-version: '1.22.3'
go-version-file: go.mod
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL

View File

@ -36,7 +36,7 @@ jobs:
- name: Set go version
uses: actions/setup-go@v4
with:
go-version: '1.22.3'
go-version-file: go.mod
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL

View File

@ -22,7 +22,7 @@ jobs:
- name: Set go version
uses: actions/setup-go@v4
with:
go-version: '1.22.3'
go-version-file: go.mod
- name: Workspace Sync
run: go work sync

View File

@ -36,7 +36,7 @@ jobs:
- name: "Setup Go"
uses: "actions/setup-go@v4"
with:
go-version: '1.22.3'
go-version-file: go.mod
- name: "Verify kinds"
run: go run .github/workflows/scripts/kinds/verify-kinds.go

View File

@ -39,7 +39,7 @@ jobs:
- name: "Setup Go"
uses: "actions/setup-go@v4"
with:
go-version: '1.22.3'
go-version-file: go.mod
- name: "Verify kinds"
run: go run .github/workflows/scripts/kinds/verify-kinds.go

View File

@ -18,7 +18,7 @@ jobs:
- name: "Setup Go"
uses: "actions/setup-go@v4"
with:
go-version: '1.22.3'
go-version-file: go.mod
- name: "Verify kinds"
run: go run .github/workflows/scripts/kinds/verify-kinds.go

View File

@ -6,17 +6,15 @@ Example PR: https://github.com/grafana/grafana/pull/79329
## The main areas that need to change during the upgrade are:
- https://github.com/grafana/grafana/blob/d8ecea4ed93efb2e4d64a5ee24bc08f3805f413d/scripts/drone/variables.star#L6
- https://github.com/grafana/grafana/blob/d8ecea4ed93efb2e4d64a5ee24bc08f3805f413d/Makefile#L264
- https://github.com/grafana/grafana/blob/d8ecea4ed93efb2e4d64a5ee24bc08f3805f413d/Dockerfile#L6
- [`go.mod`](/go.mod#L3)
- [`go.work`](/go.work#L1)
- [`scripts/drone/variables.star`](/scripts/drone/variables.star#L6)
- [`Makefile`](/Makefile#L12)
- [`Dockerfile`](/Dockerfile#L6)
Make sure to run `make drone` so that changes to `.star` files are reflected and `drone.yml` is generated.
Then, run `go mod tidy` and `go work sync`. Also run `make drone` so changes to `.star` files are reflected and `drone.yml` is updated.
### Additional files to change
- Take a look in `.github/workflows` folder for what `go` version is being used there in various workflows.
- Make sure to create a PR with the corresponding changes in `grafana/grafana-enterprise` repository.
## Updating the go.mod file
Please avoid updating the `go.mod` to the newest version unless really necessary. This ensures backwards compatibility and introduces less breaking changes. Always upgrade Go version in the runtime files above first, let them run for a couple of weeks and only then consider updating the `go.mod` file if necessary.