-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setup-go action should allow for existing cache files #403
Comments
Hello @shaunco ! Thank you for reporting the issue, we will investigate it and get back to you as soon as we have more info :) |
Thanks @dusan-trickovic ! Not sure if it is related, but we also seem to end up with quite a few duplicate |
Hello @shaunco,
this should solve the problem. |
Based on my understanding, |
@bc-lee Self-hosted runner preserves the cache and builds results so caching does not have sense for them, we should disable caching for them by default. Currently it can be turned off manually |
@dsame Aha, that makes sense. I'm not sure if changing the default based on where the runner is running (i.e., provided by GitHub or self-hosted) is a good idea. I think it would be much better for the user to explicitly specify that option. |
Hello @bc-lee my motivation to have the different value of |
I changed this bug to feature request basing on
|
Hi @dsame
This is not always true. We use the ephemeral self-hosted runners so it would be great to have the cache available. |
@shaunco Any updates on this? After updating to Go version: --- a/go.mod
+++ b/go.mod
@@ -1,6 +1,8 @@
module github.com/company/repo
-go 1.20
+go 1.21.1
+
+toolchain go1.21.6
require ( We start having these warnings in the build:
|
When cache is enabled we always get warnings from tar: usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/[email protected]/doc.go: Cannot open: File exists /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/[email protected]/LICENSE: Cannot open: File exists /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/[email protected]/config.json: Cannot open: File exists /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/[email protected]/go.mod: Cannot open: File exists /usr/bin/tar: Exiting with failure status due to previous errors Warning: Failed to restore: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2 According to setup-go issue[1] the mitigation is to disable the cache. [1] actions/setup-go#403
When cache is enabled we always get warnings from tar: usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/[email protected]/doc.go: Cannot open: File exists /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/[email protected]/LICENSE: Cannot open: File exists /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/[email protected]/config.json: Cannot open: File exists /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/[email protected]/go.mod: Cannot open: File exists /usr/bin/tar: Exiting with failure status due to previous errors Warning: Failed to restore: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2 According to setup-go issue[1] the mitigation is to disable the cache. Strangely, when the cache is disabled, the setup-go step is adding go to the cache: Adding to the cache ... Successfully cached go to /opt/hostedtoolcache/go/1.23.0/x64 [1] actions/setup-go#403
This issue happens also in github runners, this is not a self-hosted runner issue. Example build with default cache (true):
Example build with cache: false:
Note these confusing logs - only when cache is disabled:
Finally using cache: true setup-go took 12 seconds, and with cache: false 7 seconds. |
When cache is enabled we always get warnings from tar: usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/[email protected]/doc.go: Cannot open: File exists /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/[email protected]/LICENSE: Cannot open: File exists /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/[email protected]/config.json: Cannot open: File exists /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/[email protected]/go.mod: Cannot open: File exists /usr/bin/tar: Exiting with failure status due to previous errors Warning: Failed to restore: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2 According to setup-go issue[1] the mitigation is to disable the cache. Strangely, when the cache is disabled, the setup-go step is adding go to the cache: Adding to the cache ... Successfully cached go to /opt/hostedtoolcache/go/1.23.0/x64 [1] actions/setup-go#403
When cache is enabled we always get warnings from tar: usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/[email protected]/doc.go: Cannot open: File exists /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/[email protected]/LICENSE: Cannot open: File exists /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/[email protected]/config.json: Cannot open: File exists /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/[email protected]/go.mod: Cannot open: File exists /usr/bin/tar: Exiting with failure status due to previous errors Warning: Failed to restore: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2 According to setup-go issue[1] the mitigation is to disable the cache. Strangely, when the cache is disabled, the setup-go step is adding go to the cache: Adding to the cache ... Successfully cached go to /opt/hostedtoolcache/go/1.23.0/x64 [1] actions/setup-go#403
When cache is enabled we always get warnings from tar: usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/[email protected]/doc.go: Cannot open: File exists /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/[email protected]/LICENSE: Cannot open: File exists /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/[email protected]/config.json: Cannot open: File exists /usr/bin/tar: ../../../go/pkg/mod/golang.org/x/telemetry/[email protected]/go.mod: Cannot open: File exists /usr/bin/tar: Exiting with failure status due to previous errors Warning: Failed to restore: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2 According to setup-go issue[1] the mitigation is to disable the cache. Strangely, when the cache is disabled, the setup-go step is adding go to the cache: Adding to the cache ... Successfully cached go to /opt/hostedtoolcache/go/1.23.0/x64 [1] actions/setup-go#403
Description:
On a self-hosted runner that is already caching tools, the v4 setup-go action attempts to call
tar
to extract its mod cache and ends up with a bunch of "Cannot open: File exists" errors, and eventuallyAction version:
v4
Platform:
Runner type:
Tools version:
^1.20
Repro steps:
Expected behavior:
Existing files should be ignored via the
-k
or--skip-old-files
option ontar
Actual behavior:
Existing files are treated as errors.
The text was updated successfully, but these errors were encountered: