ci(canary): clear bundle output so canaries can't ship a stale installer - #5429
Open
Glucksberg wants to merge 1 commit into
Open
ci(canary): clear bundle output so canaries can't ship a stale installer#5429Glucksberg wants to merge 1 commit into
Glucksberg wants to merge 1 commit into
Conversation
The four canary workflows restore `desktop/src-tauri/target` from an actions/cache entry and rely on `!desktop/src-tauri/target/**/release/bundle` in the path list to keep bundle output out of it. That exclusion is a no-op: negating a subpath of an already-included directory does not stop tar from recursing into it, so installers do enter the cache and a cache hit restores the previous run's artifact next to the new one. Every locate step then picks a file with `find … | head -1`, which can return the restored artifact instead of the one just built. On a fork running the Windows canary this uploaded run 1's installer as run 2's canary. On Linux the same restore trips the AppImage post-process step's "expected exactly one AppImage" check and fails the build. Remove the bundle directory before each `tauri build`, and correct the cache comments that claim the exclusion works. Signed-off-by: Glucksberg <glucksberg89@gmail.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.
Summary
All four canary workflows can upload an installer that was not built by that run.
Each one restores
desktop/src-tauri/targetfrom anactions/cacheentry and lists!desktop/src-tauri/target/**/release/bundlealongside it, with a comment stating that this keeps installers out of the cache:That exclusion does nothing.
actions/cacheresolves thepath:list through@actions/globinto a set of paths and hands those totar. A!pattern removes entries from that resolved set — butdesktop/src-tauri/target/**/release/bundlewas never a separate entry, only its ancestordesktop/src-tauri/targetwas. Removing something that isn't in the list changes nothing, andtarstill recurses into the directory. Bundle output goes into the cache, and a cache hit restores the previous run's installer into a tree where the new build is about to land.Then every locate step picks its artifact like this:
EXE=$(find "$BUNDLE_DIR/nsis" -name '*.exe' -type f | head -1)With two installers present,
head -1is a coin flip, and the losing side is a canary artifact containing last run's code.Evidence
This is not theoretical — I hit it on a fork while field-testing a Windows fix:
fork.1.fork.2on top of new commits, got a cache hit, and uploaded run 1'sfork.1installer. I installed it, saw the old behaviour, and spent a cycle re-diagnosing a bug that was already fixed.A maintainer can confirm the cache side directly: on the next canary run that reports
cache-hit: true,ls -R desktop/src-tauri/target/*/release/bundleimmediately after the restore step and before the build — the previous run's artifacts are there.The Linux canary shows the same fault as a hard failure rather than a silent swap. Its AppImage post-process step counts what it finds:
A restored AppImage plus a freshly built one is exactly two.
The signed macOS canary is the worst case: a stale DMG picked by
head -1is then signed and notarized by the rest of that job, so a correctly signed, correctly notarized build ships the wrong code.The change
One step per workflow, immediately before
pnpm tauri build:(
target/${TARGET}/release/bundlein the two cross-compiled workflows.) It removes only bundler output — no compiled crates, no incremental artifacts — so cache effectiveness is unchanged.The four misleading comments above the cache-save steps are corrected to say what actually happens.
windows-canary.ymltarget/${TARGET}/release/bundlemacos-intel-canary.ymltarget/${TARGET}/release/bundlelinux-canary.ymltarget/release/bundlesigned-macos-canary.ymltarget/release/bundleDeliberately left alone
Bundle output still enters the cache on save — this PR stops the stale artifact from being used, not from being stored. Making the storage side match the original intent needs the bundle directory cleared before
actions/cache/save, and the step order differs across these files (Linux and signed macOS save the cache before their locate/upload steps, Windows saves after), so there is no uniform placement. Happy to follow up if you want the dead!patterns removed and the save side actually enforced — I kept this PR to the defect that ships wrong binaries.I also considered tightening each
findto match the run's derived version string.windows-canary.ymlandsigned-macos-canary.ymlexposesteps.version.outputs.version, butmacos-intel-canary.ymlderives its version inside arun:block with no output, so it would have been inconsistent — and redundant once the directory is empty.Testing
${{ }}expression, so nothing new forzizmorto flag.workflow_dispatch-only and gated ongithub.repository == 'block/buzz', so I can't exercise them from a fork against this repo. The equivalentrm -rfhas been running in my fork's Windows canary since the stale-installer incident: subsequent runs shipped the right build, with no change in Cargo cache hit rate or build time.Searched open PRs: none touch
.github/workflows/*canary*.