René's URL Explorer Experiment


Title: Lock each component on its target servers during deploy, rollback and restart by shipmill-romamo[bot] · Pull Request #269 · cloudfall-dev/cloudfall · GitHub

Open Graph Title: Lock each component on its target servers during deploy, rollback and restart by shipmill-romamo[bot] · Pull Request #269 · cloudfall-dev/cloudfall

X Title: Lock each component on its target servers during deploy, rollback and restart by shipmill-romamo[bot] · Pull Request #269 · cloudfall-dev/cloudfall

Description: Plan Serves: quality bar Files: engine/ansible/playbooks/tasks/component-lock-take.yml and component-lock-release.yml (new), engine/ansible/playbooks/lock.yml (new, reads and clears one component's server locks), deploy.yml, rollback.yml, restart.yml, sdk/src/cloudfall/server_locks.py (new), sdk/src/cloudfall/app.py, commands.py and component_lock.py (lock clear), sdk/README.md, engine/tests/test_component_hosts.py, engine/tests/test_release_command.py (stand-in lock directories), sdk/tests/test_server_locks.py (new), sdk/tests/test_component_lock.py, changelog.d/221-target-host-lock.md Order: failing test first (a lock left on the stand-in server makes deploy, rollback and restart fail there before the role runs), then the take and release task files and their use in the three playbooks, then lock.yml and lock clear reading and clearing the server locks behind the same typed confirmation Proof: engine/tests/test_component_hosts.py (held lock refuses, lock held while the role runs and released after a passed and a failed run, an unreachable server leaves no other server locked, all through cloudfall-engine playbook run), sdk/tests/test_server_locks.py (lock.yml reads a server lock with holder and age, clears exactly the lock shown, keeps one taken again since, reports an unreachable server, refuses a malformed record), sdk/tests/test_component_lock.py still passing, ansible-lint Stacked on #268. Summary #261 built the management-host half of #221. This PR builds the lock on each target server, so two controllers, cloudfall-engine playbook run and approved runs of the playbooks no longer race on a server's current symlink, unit file and the release command's transient unit. tasks/component-lock-take.yml writes a holder record (component, action, user, management host, start time, token) to a private file and hard-links it to /var/lib/cloudfall/locks/.json with ln, which refuses an existing target, so taking it is atomic and the record is whole as soon as it exists. On a held lock the run fails on that server before the role runs: "Component crm-backend is locked on server h2 by a deploy that someone started on elsewhere.invalid at 2026-11-13T10:58:00Z, 2 hours ago; nothing changed on this server. If no deploy of it is running, a person clears the lock with cloudfall lock clear crm-backend" deploy (both plays), rollback and restart take it as the first task of a block whose always imports tasks/component-lock-release.yml, which removes the lock only when its token is this run's. A --check run takes no lock The directory is root's (the plays run with become), outside the component's install root and its sandbox's writable paths, so the component's user cannot touch it. It is the variable cloudfall_component_lock_directory, which the tests point at a temporary directory per stand-in server The lock covers one server's turn of the serial play: each server takes it before its changes and releases it before the next server starts, so an unreachable or failed server never leaves another one locked (tested). Two runs can still interleave across servers (B on h1 while A is on h2); each server's changes are serialized, and the management-host lock from #261 keeps whole runs from one controller apart cloudfall lock clear (extended, same confirmation): it still refuses a management-host lock whose process runs here before anything else, then reads the component's lock on each declared server through the new lock.yml (in parallel, ignore_unreachable, read-only), names every lock with its holder and age and every server it could not reach in the prompt, and once the component id is typed removes the server locks it showed (only when the token is unchanged), then the management-host lock. A server lock taken again since it was shown, or a server no longer reached, fails the command with CONFLICT before the management-host lock goes. New keys serverLocks and unreadServers; flags --engine and --inventory-file; ENGINE_STEP_FAILED added to its exit codes; it is now classified among the commands that change servers, with its typed id as the gate. A component the config no longer declares reads no server TIMESTAMP_FORMAT and age_text in component_lock.py are now public, so the server lock uses #261's words for ages Decisions for you contract-change (notify): cloudfall lock clear contacts the component's servers, gains --engine/--inventory-file, the serverLocks/unreadServers keys and the ENGINE_STEP_FAILED exit, and moves from "writes project files" to "changes servers" in the command contract. Additive for callers of the old output contract-change: new bundled playbook lock.yml (shows in cloudfall-engine playbook list) and a new path on every server, /var/lib/cloudfall/locks/ interpretation: the server lock is held per server turn (needed for always to release it), not across the whole rollout interpretation: operator approve runs services.yml and baseline.yml, which take no lock (other playbooks are out of scope); decisions approve gets the lock only when the operation's playbook is the engine's deploy, rollback or restart Test plan uv run pytest engine/tests (413 run: the 3 two-host cases of test_release_command.py needed their stand-ins' lock directories apart, fixed in the second commit and green on rerun) and the SDK tests that touch these paths: test_component_lock, test_server_locks (new), test_commands, test_project, test_agent_server, test_catalog, test_resources, test_lifecycle, test_deploy_approval, test_decision, test_operator, test_release_command_plan, test_command_health_check, test_migrate_approval, test_domains_apply: all pass The new engine tests fail on #268's branch (the role ran under another run's lock) and pass here uv run ruff check ., uv run mypy, ansible-lint engine/ansible (production profile): pass lock.yml is not in CI's ansible-playbook --syntax-check list yet: a change under .github/ is a security decision that would hold this PR for the maintainer, so it is left for a separate change. ansible-lint (which CI runs over engine/ansible) covers it, and sdk/tests/test_server_locks.py runs it for real Not verified: a real two-host run on Debian with become (the lock directory's ownership and ln there); the tests use local connections without become Full suite left to CI Fixes #221 🤖 Generated with Claude Code

Open Graph Description: Plan Serves: quality bar Files: engine/ansible/playbooks/tasks/component-lock-take.yml and component-lock-release.yml (new), engine/ansible/playbooks/lock.yml (new, reads and clears one component&...

X Description: Plan Serves: quality bar Files: engine/ansible/playbooks/tasks/component-lock-take.yml and component-lock-release.yml (new), engine/ansible/playbooks/lock.yml (new, reads and clears one component&...

Opengraph URL: https://github.com/cloudfall-dev/cloudfall/pull/269

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.3

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:a0521899-90e2-d0f6-953d-0bee8c2a567f
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD932:3B6A24:E732D6:13C59AA:6B0557B2
html-safe-nonce337d3ffb2f9e20081ce5fe7635473539e08602bce9521aa5d146f05833d52c79
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOTMyOjNCNkEyNDpFNzMyRDY6MTNDNTlBQTo2QjA1NTdCMiIsInZpc2l0b3JfaWQiOiI0Nzk0NTE4OTQyNjA3ODI0ODE4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac044d19139b4f7539ef067e68e9ef4d53409d7e62fd24ce2ed3aa22f58ca7477a
hovercard-subject-tagpull_request:5296092876
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/cloudfall-dev/cloudfall/pull/269/files
twitter:imagehttps://avatars.githubusercontent.com/u/5600783?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/5600783?s=400&v=4
og:image:altPlan Serves: quality bar Files: engine/ansible/playbooks/tasks/component-lock-take.yml and component-lock-release.yml (new), engine/ansible/playbooks/lock.yml (new, reads and clears one component&...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonea79a02b7e7546ea306864e922ed2103ef4c04fac63168e11c2b2d4d816793080
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/cloudfall-dev/cloudfall git https://github.com/cloudfall-dev/cloudfall.git
octolytics-dimension-user_id339512759
octolytics-dimension-user_logincloudfall-dev
octolytics-dimension-repository_id1360999777
octolytics-dimension-repository_nwocloudfall-dev/cloudfall
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1360999777
octolytics-dimension-repository_network_root_nwocloudfall-dev/cloudfall
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release10dff83edfd4f3617a7792a152d44991587b434c
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/cloudfall-dev/cloudfall/pull/269/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcloudfall-dev%2Fcloudfall%2Fpull%2F269%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcloudfall-dev%2Fcloudfall%2Fpull%2F269%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=cloudfall-dev%2Fcloudfall
Reloadhttps://github.com/cloudfall-dev/cloudfall/pull/269/files
Reloadhttps://github.com/cloudfall-dev/cloudfall/pull/269/files
Reloadhttps://github.com/cloudfall-dev/cloudfall/pull/269/files
cloudfall-devhttps://github.com/cloudfall-dev
cloudfallhttps://github.com/cloudfall-dev/cloudfall
Codehttps://github.com/cloudfall-dev/cloudfall
Issues78 (78)https://github.com/cloudfall-dev/cloudfall/issues
Pull requests10 (10)https://github.com/cloudfall-dev/cloudfall/pulls
Discussionshttps://github.com/cloudfall-dev/cloudfall/discussions
Actionshttps://github.com/cloudfall-dev/cloudfall/actions
Security and qualityhttps://github.com/cloudfall-dev/cloudfall/security
Insightshttps://github.com/cloudfall-dev/cloudfall/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fcloudfall-dev%2Fcloudfall%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fcloudfall-dev%2Fcloudfall%2Fissues%2Fnew%2Fchoose
shipmill-romamohttps://github.com/apps/shipmill-romamo
mainhttps://github.com/cloudfall-dev/cloudfall/tree/main
fix/221-target-host-lockhttps://github.com/cloudfall-dev/cloudfall/tree/fix/221-target-host-lock
Conversation 1 https://github.com/cloudfall-dev/cloudfall/pull/269
Commits 4 https://github.com/cloudfall-dev/cloudfall/pull/269/commits
Checks 1 https://github.com/cloudfall-dev/cloudfall/pull/269/checks
Files changed 16 https://github.com/cloudfall-dev/cloudfall/pull/269/files
Lock each component on its target servers during deploy, rollback and restart https://github.com/cloudfall-dev/cloudfall/pull/269/files#top
Show all changes 4 commits https://github.com/cloudfall-dev/cloudfall/pull/269/files
1b1bead Lock each component on its target servers during deploy, rollback and… shipmill-romamo[bot] Nov 13, 2026 https://github.com/cloudfall-dev/cloudfall/pull/269/commits/1b1bead905858b99cfddeeab369c8c14397f0584
62f5a71 Keep the release command test's stand-in locks apart shipmill-romamo[bot] Nov 13, 2026 https://github.com/cloudfall-dev/cloudfall/pull/269/commits/62f5a71dffde81b9ecab8e31ce458222a9772a1e
b4e283f Leave lock.yml out of CI's syntax-check list for now shipmill-romamo[bot] Nov 13, 2026 https://github.com/cloudfall-dev/cloudfall/pull/269/commits/b4e283f8bf9218ed07f2cd607587ef43a7f56421
d41c3ab Merge remote-tracking branch 'origin/main' into review-269 shipmill-romamo[bot] Nov 13, 2026 https://github.com/cloudfall-dev/cloudfall/pull/269/commits/d41c3abedc87f5699e6cb66dc0ed0b66aa5f75b0
Clear filters https://github.com/cloudfall-dev/cloudfall/pull/269/files
Please reload this pagehttps://github.com/cloudfall-dev/cloudfall/pull/269/files
Please reload this pagehttps://github.com/cloudfall-dev/cloudfall/pull/269/files
221-target-host-lock.md https://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-56d0348e03ffa7222712be707fc0233a6c1e358a6f659249fdcaa6d70695ddf0
deploy.yml https://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-6bd433ab5a94386e73ee6c906c694e4132e038ad66266e3cd7886911c5781582
lock.yml https://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-962980980a790b25067839b531281ae86931167833c35bc883f64eb02ece9cd2
restart.yml https://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-ab682f7df47938fae4c2e88c4271b83223ffff34ad6abe81d379cb4e92fb82ae
rollback.yml https://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-b8d6fda07528697eb0261a8f48b007db16833af69fb33852a5326b62e7814c4f
component-lock-release.yml https://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-e0fbb52e30a9b43144e9ece083d386fd3679e24e0fe625d391c3ffe2df94f25f
component-lock-take.yml https://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-929f296af43422e9a8930795c83e57b778f1406100c23beddd8166d2d31a57c8
test_component_hosts.py https://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-aa607293d32be2f868d8089c7df610dabf79617fc152d868c7098ed9001cede5
test_release_command.py https://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-ac295603afd74510633fb5e9b3315481f5da0e4aa8519913a3ca7f3984246208
README.md https://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-00ba42324c784ebcf27766700a3924a25e593009a52d5431331d42bef9edd2e9
app.py https://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-80944e9d32bf3de16b8f897a076d9413719c085027f33cffff3fd7b0358d8763
commands.py https://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-e11cc5881f876e11cf81d9bcb39f0fb74710976f27a01a99fb979dfc76c09cc1
component_lock.py https://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-bf51dc445edbdccac4365b7e8d6c89de809c4beab3ef73708415ca0a62e9747f
server_locks.py https://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-7f959a0bd50e0e0702edb2528b30c37ba487ebc1b8c17e87905e14df163746a8
test_component_lock.py https://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-a6be1994b8d25e771f8917543401999b56bca20a2719ae8c48efb242359cf805
test_server_locks.py https://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-cdb06430f9b8e113ae41d30b01976d38b9c9ea1fe1cbf084a08b229b597ba379
changelog.d/221-target-host-lock.mdhttps://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-56d0348e03ffa7222712be707fc0233a6c1e358a6f659249fdcaa6d70695ddf0
View file https://github.com/cloudfall-dev/cloudfall/blob/d41c3abedc87f5699e6cb66dc0ed0b66aa5f75b0/changelog.d/221-target-host-lock.md
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/cloudfall-dev/cloudfall/pull/269/{{ revealButtonHref }}
engine/ansible/playbooks/deploy.ymlhttps://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-6bd433ab5a94386e73ee6c906c694e4132e038ad66266e3cd7886911c5781582
View file https://github.com/cloudfall-dev/cloudfall/blob/d41c3abedc87f5699e6cb66dc0ed0b66aa5f75b0/engine/ansible/playbooks/deploy.yml
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/cloudfall-dev/cloudfall/pull/269/{{ revealButtonHref }}
https://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-6bd433ab5a94386e73ee6c906c694e4132e038ad66266e3cd7886911c5781582
https://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-6bd433ab5a94386e73ee6c906c694e4132e038ad66266e3cd7886911c5781582
engine/ansible/playbooks/lock.ymlhttps://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-962980980a790b25067839b531281ae86931167833c35bc883f64eb02ece9cd2
View file https://github.com/cloudfall-dev/cloudfall/blob/d41c3abedc87f5699e6cb66dc0ed0b66aa5f75b0/engine/ansible/playbooks/lock.yml
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/cloudfall-dev/cloudfall/pull/269/{{ revealButtonHref }}
engine/ansible/playbooks/restart.ymlhttps://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-ab682f7df47938fae4c2e88c4271b83223ffff34ad6abe81d379cb4e92fb82ae
View file https://github.com/cloudfall-dev/cloudfall/blob/d41c3abedc87f5699e6cb66dc0ed0b66aa5f75b0/engine/ansible/playbooks/restart.yml
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/cloudfall-dev/cloudfall/pull/269/{{ revealButtonHref }}
https://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-ab682f7df47938fae4c2e88c4271b83223ffff34ad6abe81d379cb4e92fb82ae
engine/ansible/playbooks/rollback.ymlhttps://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-b8d6fda07528697eb0261a8f48b007db16833af69fb33852a5326b62e7814c4f
View file https://github.com/cloudfall-dev/cloudfall/blob/d41c3abedc87f5699e6cb66dc0ed0b66aa5f75b0/engine/ansible/playbooks/rollback.yml
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/cloudfall-dev/cloudfall/pull/269/{{ revealButtonHref }}
https://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-b8d6fda07528697eb0261a8f48b007db16833af69fb33852a5326b62e7814c4f
engine/ansible/playbooks/tasks/component-lock-release.ymlhttps://github.com/cloudfall-dev/cloudfall/pull/269/files#diff-e0fbb52e30a9b43144e9ece083d386fd3679e24e0fe625d391c3ffe2df94f25f
View file https://github.com/cloudfall-dev/cloudfall/blob/d41c3abedc87f5699e6cb66dc0ed0b66aa5f75b0/engine/ansible/playbooks/tasks/component-lock-release.yml
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/cloudfall-dev/cloudfall/pull/269/{{ revealButtonHref }}
Please reload this pagehttps://github.com/cloudfall-dev/cloudfall/pull/269/files
Please reload this pagehttps://github.com/cloudfall-dev/cloudfall/pull/269/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.