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>
pull/87580/head
Dave Henderson 1 year ago committed by GitHub
parent 49cd917b08
commit c6a0175c04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      .github/workflows/alerting-swagger-gen.yml
  2. 2
      .github/workflows/bump-version.yml
  3. 2
      .github/workflows/codeql-analysis.yml
  4. 2
      .github/workflows/pr-codeql-analysis-go.yml
  5. 2
      .github/workflows/pr-go-workspace-check.yml
  6. 2
      .github/workflows/publish-kinds-next.yml
  7. 2
      .github/workflows/publish-kinds-release.yml
  8. 2
      .github/workflows/verify-kinds.yml
  9. 14
      contribute/backend/upgrading-go-version.md

@ -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

@ -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'

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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.

Loading…
Cancel
Save