Skip to content

chore(cli): fix windows build cache tar self-inclusion failure#14933

Open
sarayev wants to merge 1 commit into
devfrom
chore/fix-windows-cache-tar-self-inclusion
Open

chore(cli): fix windows build cache tar self-inclusion failure#14933
sarayev wants to merge 1 commit into
devfrom
chore/fix-windows-cache-tar-self-inclusion

Conversation

@sarayev

@sarayev sarayev commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Description of changes

The Windows build cache storeCache step in
codebuild_specs/scripts-windows/shared-scripts-windows.sh archived
the repository root with tar -czf cache.tar . and then uploaded the
resulting cache.tar. Because the archive was written into the very
directory being archived, GNU tar aborted with "Can't add archive to
itself", causing the build_windows cache step to fail on every PR.

This change streams the archive straight to S3 instead of writing a
temp file:

tar cz . | aws s3 cp - $s3Path

No on-disk cache.tar is ever created, so there is nothing for tar to
recurse into. This matches the canonical streaming pattern already
used by the Linux storeCache (shared-scripts.sh) and the Windows
loadCache in the same file. The stale commented-out copy of the old
command was also removed.

Issue #, if available

N/A

Description of how you validated changes

Ran bash -n codebuild_specs/scripts-windows/shared-scripts-windows.sh
to confirm the script parses with no syntax errors. The fix mirrors the
already-working streaming pattern used elsewhere in the same script.

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)
  • New AWS SDK calls or CloudFormation actions have been added to relevant test and service IAM policies
  • Pull request labels are added

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

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
@sarayev sarayev requested a review from a team as a code owner June 22, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant