fix: reuse stale tailscale.tgz on self-hosted runners#305
Merged
Conversation
On persistent self-hosted runners the XDG cache directory survives between jobs. When GitHub's Actions cache backend doesn't return a hit (no working backend, evicted entry, etc.), the tailscale.tgz left behind by a previous job is still on disk, and tc.downloadTool() refuses to overwrite an existing destination, failing with "Destination file path ... already exists". Mirror the Windows MSI fix (tailscale#259): if the tarball already exists, reuse it when its checksum matches, otherwise delete and re-download. Only the cloud-cache-restore path previously avoided this collision, so the Linux download was unconditional. Fixes tailscale#294 Signed-off-by: TowyTowy <towy@airreps.link> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On persistent self-hosted runners the XDG cache directory survives between jobs. When GitHub's Actions cache backend does not return a hit (no working backend, evicted entry, etc.), the tailscale.tgz left behind by a previous job is still on disk, and
tc.downloadTool()refuses to overwrite an existing destination, failing with "Destination file path ... already exists" (retried 3x by the retry helper).This implements the maintainer-preferred Option 3 from the issue and mirrors the existing Windows MSI fix (#259): if the tarball already exists, reuse it when its sha256 matches, otherwise delete and re-download. Previously only the cloud-cache-restore path avoided the collision; the Linux download was unconditional.
Verified against the real @actions/tool-cache: the old code reproduces the exact reported failure with a stale file present; the new code reuses a checksum-matching file and replaces a mismatched one.
Includes the rebuilt dist/index.js (repo practice per #259).
Fixes #294