feat: auto-rollback when requested release is older than installed - #26
Merged
Merged
Conversation
Unifies deploy and rollback into a single operator flow — operator picks a
release in site.yml/deploy.yml (or in the Jenkins deploy dropdown), and the
playbook routes to rollback automatically if the requested version is older
than what is installed. No separate rollback job needed.
Refactor:
- roles/openspecimen/tasks/rollback.yml (new) — extracted from rollback.yml's
play body. Supports three backup-selection modes:
* backup_timestamp — explicit timestamp
* target_version — find backup whose .release matches this string
(used by the auto-rollback path)
* (neither) — most recent backup by mtime
- roles/openspecimen/tasks/direction.yml (new) — detects deploy vs rollback
direction from openspecimen_release vs the on-target .release marker
using sort -V (handles RC12 > RC8 correctly). On downgrade: dispatches
to tasks_from: rollback with target_version, then ends play.
- rollback.yml (refactor) — thin wrapper that just includes the role
tasks_from. Operator CLI invocation unchanged.
Wiring:
- site.yml / deploy.yml — direction.yml runs as the FIRST pre_task. On
rollback, the subsequent preflight + roles are skipped via end_play.
Schema-incompatible downgrade safeguard from PR #25 still applies — it lives
in the rollback task list, so both invocation paths get it.
Docs:
- docs/DEPLOY-UPGRADE.md — 'How version detection works' updated for
auto-rollback; Rollback section now distinguishes path A (automatic via
deploy job) from path B (explicit rollback.yml invocation), with
target_version usage documented.
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.
Unifies deploy and rollback into one operator flow. When site.yml/deploy.yml is invoked with a release older than the on-target .release marker, the playbook auto-routes to the rollback task list with target_version=, then ends the play. Rollback logic moved into roles/openspecimen/tasks/rollback.yml so it's reusable from both the operator's CLI rollback.yml and the auto-rollback path. Schema-incompatible downgrade safeguard from PR #25 still applies on both paths.
Companion ops repo PR will add the ALLOW_DOWNGRADE checkbox to the Jenkins deploy job.