gen-index: serialize concurrent runs, unique tmp files #5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/gen-index-concurrent-publish"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Concurrent dev-release runs (breadbar + breadbox this round) both write
${OUT}.tmpin the shared DL dir; the loser'smvfailsNo such file or directoryandset -ereddens the publish job even though the index was written fine. This is why breadbar run 126 (the shell-theme publish) looked failed.flock a per-track lock +
mktemp -uthe tmp paths. Verified 2 concurrent runs both exit 0 with one consistent index.json.Every repo's dev-release / beta-release workflow runs this script after its build. Two merges landing in the same round (breadbar + breadbox this week) run it concurrently on the one self-hosted runner, both writing `${OUT}.tmp` in the shared output dir. The second `mv "${OUT}.tmp" "${OUT}"` then fails "No such file or directory" — the first run already consumed it — and `set -e` turns that into a red publish job, even though the index was written correctly by the other run. That's the whole reason breadbar's dev-release (run 126, the shell-theme publish) showed red and the theme-capable binary looked unpublished. - flock a per-track lock for the whole run, so the two invocations serialize and the later one also sees the earlier's fresh `latest` symlink. - mktemp -u the index.json / .minisig temp paths so even an unlocked caller (INDEX_LOCK override, older workflow) can't collide. Verified: two concurrent runs against a fake DL tree both exit 0 with one consistent index.json and no leftover .tmp.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.