chore(cli): fix windows build cache tar self-inclusion failure#14933
Open
sarayev wants to merge 1 commit into
Open
chore(cli): fix windows build cache tar self-inclusion failure#14933sarayev wants to merge 1 commit into
sarayev wants to merge 1 commit into
Conversation
The Windows storeCache step ran `tar -czf cache.tar .` from the repo root and then uploaded that file, which means tar was writing cache.tar into the very directory it was archiving. GNU tar aborts with "Can't add archive to itself", so the build_windows cache step failed on every PR. Stream the archive directly to S3 instead of materializing a temp file: `tar cz . | aws s3 cp - $s3Path`. This matches the canonical pattern already used by the Linux storeCache and the Windows loadCache, neither of which create an on-disk cache.tar. Also removed the stale commented-out duplicate of the old command. Tested with `bash -n codebuild_specs/scripts-windows/shared-scripts-windows.sh`, which reports no syntax errors. --- Prompt: Create a separate pr for it and run e2e tests
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.
Description of changes
The Windows build cache
storeCachestep incodebuild_specs/scripts-windows/shared-scripts-windows.sharchivedthe repository root with
tar -czf cache.tar .and then uploaded theresulting
cache.tar. Because the archive was written into the verydirectory being archived, GNU tar aborted with "Can't add archive to
itself", causing the
build_windowscache step to fail on every PR.This change streams the archive straight to S3 instead of writing a
temp file:
No on-disk
cache.taris ever created, so there is nothing for tar torecurse into. This matches the canonical streaming pattern already
used by the Linux
storeCache(shared-scripts.sh) and the WindowsloadCachein the same file. The stale commented-out copy of the oldcommand was also removed.
Issue #, if available
N/A
Description of how you validated changes
Ran
bash -n codebuild_specs/scripts-windows/shared-scripts-windows.shto confirm the script parses with no syntax errors. The fix mirrors the
already-working streaming pattern used elsewhere in the same script.
Checklist
yarn testpassesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.