Repository navigation
Conversation
…ade and an unexpected rollback (#891) Two launches against one weft host (a deploy and a rollback, or two templates) interleaved their stop, backup, start and deploy.state writes, so one run could mark a host healthy at state the other wrote. Every deploy (tasks/weft-deploy.yml, five launchers) and Roll Back weft Host now take a non-blocking kernel flock on a root-owned deploy.lock in the state directory before anything is fetched for the stop, release it however they end, and refuse a second launch naming the run that holds it. The holder is one detached process on the host; if the controller dies mid-run the lock lapses after weft_host_lock_minutes (120). Task 5.8. A rack pin moved back to an older version used to deploy over a catalog the newer release had migrated. The deploy and the rollback now record the release a host was last started on in root-owned deploy.release, and a rack deploy whose pin is older refuses before anything stops; going back is Roll Back weft Host, which restores the backup. Task 3.4 (N3). Roll Back weft Host went back to whatever the synced inventory pinned, so an unsynced revert or the wrong host reverted restored a backup onto a release nobody chose. It now takes weft_rollback_to and refuses when the pin names another release (F35).
|
Warning Review limit reached
This review includes 13 billable files and costs up to $3.25.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 3 minutes for your next included review. View limit details
|
|
Linked to Plane Work Item(s) This comment was auto-generated by Plane |
7 of 13 tasks
This branch has not been deployed
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.
Closes three of the open items in #891. Each is listed with the failure it prevents.
One run at a time per host (N1, OpenSpec task 5.8). Semaphore runs two templates against one host if a person launches both. A deploy and a rollback of the same host would then interleave their stop, backup, start and
deploy.statewrites, and one could mark the host healthy at state the other wrote. The issue body records N1 as "no lock", but the later design (design.mdknown gaps, task 5.8, 2026-11-28) makes the lock a gate before the rack, so this follows the design. Every deploy (tasks/weft-deploy.yml, reached by five launchers) and Roll Back weft Host now take a non-blocking kernelflockon a root-owneddeploy.lockin the role's state directory before anything is fetched for the stop. They release it in analways, however the run ends. A second launch is refused before it changes anything, and the refusal names the play holding the lock, when it took it and when it lapses. An Ansible run is many short processes, so the holder is one detached process on the host. The accepted cost: if the controller dies mid-run, nothing releases the lock, and it lapses afterweft_host_lock_minutes(default 120, refused if not longer than the health window and the watch together). The template descriptions that told people to check Semaphore's running tasks now describe the lock.A deploy only moves a rack host forward (N3, task 3.4). A pin reverted to an older version used to deploy that older binary over a catalog the newer release had already migrated. The deploy and the rollback now write the release a host was last started on to a root-owned
deploy.release. The deploy writes it after the backup verifies and before the start that migrates. A rack deploy whose pin is an older version than that refuses before anything stops, and says to use Roll Back weft Host, which restores the backup and does not run this check. Staging is not checked because its pins are commits, which have no order.A rollback goes only where the person meant (F35). Roll Back weft Host deployed whatever the synced inventory pinned. A revert not yet synced, or the wrong host reverted, would restore the backup onto a release nobody chose. A new required survey input,
weft_rollback_to, names the intended release, and the rollback refuses before reading or moving anything when the pin names another.Left out:
vm_vmidandvm_nodedeclared in site-config, which no weft host carries today. The snapshot stays a manual step.door.keyoutside the clone, task 3.3). This needs a decision on where the key goes. The door reads the key as the deploy user (keep-id), so it cannot live in the root-owned state directory, and the door's records directory is one the door can write.dev(weft docs: 2026-10-13 proofs, the Alloy outage, and two ledger entries #585), with tests intest_weft_deploy_runs.py.Tests (
platform/tests/test_weft_deploy_runs.py, run against the real tasks and a fake engine): a deploy is refused while another run holds the lock, and nothing is stopped; the lock is free after a passing deploy and after a failed one; an older rack pin is refused before the stop; a newer pin deploys (v1.10.0afterv1.9.0); staging deploys any commit; the realrollback-weft-host.ymlrefuses aweft_rollback_tothat the pin does not name and goes on when it does. I mutated the lock release and the version comparison and saw the tests go red. The bats rescue-extraction test is updated for the new block nesting.Nothing was run against a real host.