Repository navigation
fix(cache): restore symlinks in task outputs as links - #885
Open
jasonkuhrt wants to merge 2 commits into
Open
jasonkuhrt wants to merge 2 commits into
jasonkuhrt wants to merge 2 commits into
Conversation
Output archives followed symbolic links and kept regular files only, and output globs listed regular files only, so a cache hit dropped every link a task's output held. Archive links as links, let output globs list them, and restore directory links as directory links on Windows. Bump the cache schema so entries archived without their links are not replayed.
This branch has not been deployed
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.
Addresses causes 1 and 2 of #884: links an
outputglob matches now survive a cache hit.Motivation
A cache hit leaves out the symbolic links in a task's outputs, so a replayed build differs from the one the task produced. Nitro's server build is one case: its dependency tracer links
server/node_modules/tslibto.nf3/tslib@2.8.1, and after a hit the replayed server resolvestsliboutside its own output. #884 has a minimal repro.Changes
create_output_archivereads outputs withsymlink_metadataand stores a link as a tar symlink entry with its target, never followed. A directory link, a file link and a dangling link round-trip as the task left them.walk_glob_filespasses links through to output collection;compute_globbed_inputsstill takes regular files only, so input hashing is unchanged.tarrestores every link withsymlink_file. Extraction there unpacks asArchive::unpackdoes, then turns a restored link whose target is a directory into a directory link.CACHE_SCHEMA_VERSIONgoes to 19, so entries archived without their links aren't replayed.Restoring still refuses to write through a link that points outside the workspace (
tar'sunpack_incheck); a test covers it.Not covered: automatic output tracking still doesn't see a link being created (fspy has no
symlink/symlinkatorCreateSymbolicLinkWinterceptor), so a task needs anoutputglob that matches its links. #884 keeps that part open.