fix: archive build output as a single tarball instead of raw glob paths - #1395
Conversation
The first real workflow_dispatch test of the shared-build-artifact setup failed: deploy-cdn and purge-cdn-cache both errored on a missing packages/*/dist/umd, even though the build job's own build step produced it correctly (confirmed locally - a clean `yarn build --force` does produce packages/browser/dist/umd and packages/consent/*/dist/umd). Root cause: upload-artifact was given two separate glob patterns (packages/*/dist, packages/consent/*/dist). With more than one path pattern, it computes a shared least-common-ancestor root across all matched files and strips it from the archived paths - since packages/consent/*/dist sits one directory level deeper than packages/*/dist, this stripped an inconsistent number of leading path segments per pattern, and on download-artifact's side the restored files landed one level too shallow (e.g. ./browser/dist/umd instead of ./packages/browser/dist/umd). Fixed by tarring the exact same paths into a single file in the build job (tar preserves relative paths exactly, no LCA-guessing) and uploading/downloading that one file instead of raw directory globs, then extracting it after download in publish and deploy-cdn. Verified locally: tar -czf across the same paths, then tar -xzf into a scratch dir, reproduces the exact expected structure.
|
…e-role Matches this org's convention for pipeline files (comment-free, same as ajs-renderer's .buildkite/pipeline.yml) - no functional change, same SHAs/values throughout.
Codecov Report✅ All modified and coverable lines are covered by tests. Please upload reports for the commit 07383af to get more accurate results. Additional details and impacted files@@ Coverage Diff @@
## master #1395 +/- ##
=======================================
Coverage 91.59% 91.59%
=======================================
Files 127 127
Lines 4142 4142
Branches 1033 1033
=======================================
Hits 3794 3794
Misses 348 348
☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
The first real
workflow_dispatchtest of the shared-build-artifact setup (#1394) failed:deploy-cdnandpurge-cdn-cache:consentboth errored on a missing.../dist/umddirectory, even though thebuildjob's own build step produced it correctly - confirmed locally, a cleanyarn build --forcedoes producepackages/browser/dist/umdandpackages/consent/*/dist/umd.Root cause
upload-artifactwas given two separate glob patterns:With more than one path pattern, it computes a shared least-common-ancestor root across all matched files and strips it from the archived paths. Since
packages/consent/*/distsits one directory level deeper thanpackages/*/dist, the LCA came out aspackages/and got stripped inconsistently - ondownload-artifact's side, the restored files landed one level too shallow (e.g../browser/dist/umdinstead of./packages/browser/dist/umd).Fix
Tar the exact same paths into a single file in the
buildjob (tarpreserves relative paths exactly - no LCA-guessing involved), upload/download that one file instead of raw directory globs, then extract it after download inpublishanddeploy-cdn.Verification
Reproduced and confirmed the fix locally:
Both land at the exact expected paths.
Test plan
workflow_dispatchrun:builduploads the tarball,publishanddeploy-cdnboth extract it and finddist/umdpresent at the expected path this time🤖 Generated with Claude Code