Skip to content

feat: auto-rollback when requested release is older than installed - #26

Merged
vsutra-admin merged 1 commit into
ansible-deployfrom
feat/auto-rollback-on-downgrade
Jun 21, 2026
Merged

feat: auto-rollback when requested release is older than installed#26
vsutra-admin merged 1 commit into
ansible-deployfrom
feat/auto-rollback-on-downgrade

Conversation

@vsutra-admin

Copy link
Copy Markdown

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.

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.
@vsutra-admin
vsutra-admin merged commit 4b3682f into ansible-deploy Jun 21, 2026
@vsutra-admin
vsutra-admin deleted the feat/auto-rollback-on-downgrade branch June 21, 2026 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant