Repository navigation
Gate type-none components on their systemd unit - #107
Merged
Merged
Conversation
A component declaring healthCheck: {type: none} (a queue worker with no
HTTP endpoint) passed schema validation, but the deploy role always ran
the HTTP uri gate with healthCheck.scheme/port/path, which are undefined
for none. The task failed, the rescue ran, and a first release was
stopped.
The HTTP gate now runs only for type http. For type none the gate
requires the service unit to be active right after the restart and
still active after a fixed settle time (role default
cloudfall_deploy_unit_settle_seconds, 10 s), so a worker that crashes
on start fails inside the block and goes through the same rescue and
rollback. Check mode still skips the gate; the receipt is unchanged.
Fixes #96
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The unit template sets Restart=on-failure, so a worker that crash-loops can read as active at the second is-active check. The gate now reads NRestarts before and after the settle pause and fails, inside the same block so the rescue still runs, when it went up or is unreadable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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
component.schema.jsonacceptshealthCheck: {type: none}for a component that serves no HTTP (a queue worker), but the deploy role's gate always ranansible.builtin.uriwithhealthCheck.scheme/port/path, which are undefined fornone. The task failed, the rescue ran, and a first release was stopped.type: http; its tasks are otherwise unchangedtype: none, inside the same block, the gate requires the systemd unit to be active right after the restart, readsNRestarts, pauses forcloudfall_deploy_unit_settle_seconds(role default 10, not a schema field), then requires the unit to be still active withNRestartsunchanged. An inactive unit, a restart while settling (Restart=on-failurecan bring a crash-looping worker back before the second check), or an unreadable count fails the task, so the existing rescue rolls back or stops a first releasehealthCheckPassedrecords that the unit gate passed)changelog.d/96-healthcheck-none.mdTest plan
engine/tests/test_deploy_role.py, in the style oftest_time_role.pyandtest_nginx_site_role.py: it evaluates the role'swhenandthatexpressions with Ansible's own templating. It covers gate selection forhttp,noneand check mode; bothis-activetasks failing on a non-zero exit;NRestartsread from systemd; the no-restart assertion passing for unchanged counts and failing for a crash loop or an unreadable count; the 10 s default; and the rescue steps for a first and a later release. The selection tests fail on the old task fileuv run ruff check .,uv run mypy,uv run pytest(541 passed),uv run cloudfall config validate --project config/examples,uv run cloudfall-engine inventory render --project config/examplesansible-playbook --syntax-checkondeploy.ymlandansible-lint engine/ansible(CI's "Ansible syntax checks" and "Ansible lint" jobs run them). No live systemd runFixes #96
🤖 Generated with Claude Code