cli/.github/workflows
Matthew Hughes 0d6bd6d53c Fix cache contention in Go CI jobs
Fix the `Set up go` and `Restore Go modules cache` steps both trying to
read/write the same contents. Since the `setup-go` step runs first this
results in the "restore cache" step trying to write the same contents
under `~/go/pkg/mod` which results in errors like (e.g. random
example[1]):

    /usr/bin/tar -xf /home/runner/work/_temp/6d12957f-f226-455e-b99c-fa7ee8c962cb/cache.tzst -P -C /home/runner/work/cli/cli --use-compress-program unzstd
    /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/net@v0.21.0/go.sum: Cannot open: File exists
    Error: /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/net@v0.21.0/proxy/proxy.go: Cannot open: File exists
    Error: /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/net@v0.21.0/proxy/socks5.go: Cannot open: File exists
    Error: /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/net@v0.21.0/proxy/dial_test.go: Cannot open: File exists

Since restoring fails, the cache job thinks no cache hit was made and
proceeds to try and save, but since it may well have fetched a valid
cache this can also error (again, see[1]):

    Post job cleanup.
    /usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/cli/cli --files-from manifest.txt --use-compress-program zstdmt
    Failed to save: Unable to reserve cache with key go-Linux-1b4ae53bfd76c3b70f62d419e17f36544d0a1331f04b13d2a942e7752e3789c3, another job may be creating this cache. More details: Cache already exists. Scope: refs/heads/trunk, Key: go-Linux-1b4ae53bfd76c3b70f62d419e17f36544d0a1331f04b13d2a942e7752e3789c3, Version: 2a8d0f2be1a88abb057cd9fcea9832bd16e7ab71798dbf93cd890eb9add83cf6

To avoid this, just rely on the caching functionality of the `seutp-go`
action.

For some context, It appears this cache behaviour was added with
cb7315c85d when these workflows were still
run with `setup-go@v2`:

    $ git show cb7315c85d3c0e010ba117ca7e692ed6f18f16c5:{.github/workflows/go.yml,.github/workflows/lint.yml} | grep 'actions/setup-go'
            uses: actions/setup-go@v2
            uses: actions/setup-go@v2

which is before caching behaviour was added (with `v3.2.0`[2]).

[1] https://github.com/cli/cli/actions/runs/8654869114/job/23732868571
[2] https://github.com/actions/setup-go/releases/tag/v3.2.0
2024-04-12 17:36:45 +01:00
..
codeql.yml Rely on go.mod go version in all workflows (#8911) 2024-04-02 13:22:31 +00:00
deployment.yml Rely on go.mod go version in all workflows (#8911) 2024-04-02 13:22:31 +00:00
go.yml Fix cache contention in Go CI jobs 2024-04-12 17:36:45 +01:00
homebrew-bump.yml Update homebrew-bump.yml 2023-10-03 10:54:44 -04:00
issueauto.yml Fixed permission for workflow (#5279) 2022-03-14 14:18:21 +01:00
lint.yml Fix cache contention in Go CI jobs 2024-04-12 17:36:45 +01:00
prauto.yml Fixed permission for workflow (#5279) 2022-03-14 14:18:21 +01:00
triage.yml Fix triage workflow, restore PR support 2023-12-05 08:46:45 -05:00