grafana / grafana/shared-workflows

setup-argo requires Go but doesn't document that fact

Open
#1,769 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
26
Forks
49
Avg merge
1d 6h
Merged PRs (30d)
36

Description

[The setup-argo action requires Go](https://github.com/grafana/shared-workflows/blob/main/actions/setup-argo/action.yaml#L35-L36), but [it doesn't document that requirement](https://github.com/grafana/shared-workflows/blob/main/actions/setup-argo/README.md).

Notice that because the way this action is constructed, this is not a hard requirement. Go is only used when the cache doesn't have the necessary file (it has expired, you are running it for the first time, the Argo version has changed).

Notice that the companion action, trigger-argo-workflow, [does use setup-go](https://github.com/grafana/shared-workflows/blob/main/actions/trigger-argo-workflow/action.yaml#L60-L66) to avoid requiring it be present in the system. This is a strange setup: `setup-argo` assumes Go is present and blindly uses it, `trigger-argo-workflow` assumes it's not present and downloads it from the Internet. You could argue that [starting with Go 1.21 this is not needed](https://tip.golang.org/doc/toolchain), as Go itself will download a newer toolchain if necessary.

Notice also that because `setup-argo` is only using Go to map the runner's OS and architecture to Go's GOOS and GOARCH variables (in order to download the right Argo binary), it doesn't need a `go.mod` file. For this reason, using `setup-go` here would not work: with `setup-go`, you must either pass the Go version you want to use or specify the path to `go.mod` (to extract the Go version from it). If the version is not provided and `go.mod` doesn't exist, `setup-go` fails. `trigger-argo-workflow` does use the Go compiler and it *has* a go.mod file, this is why it can use `setup-go`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.