1
0
mirror of https://github.com/quay/quay.git synced 2026-10-23 09:49:06 +03:00
Files
Harish Govindarajulu 2f2a18ed9e PROJQUAY-13482: fix(omr): roll back to previous image when upgrade health check fails (#7553)
* PROJQUAY-13482: fix(omr): roll back to previous image when upgrade health check fails

After an upgrade, if the health check fails, the registry is left in a
broken state with the new image and no record of the previous image ref.
The user must manually determine the old image and edit the Quadlet file
to recover.

Save the previous image ref from the Quadlet file before overwriting.
On health check failure, automatically restore the previous image,
reload systemd, restart, and verify health. If rollback also fails,
report both image refs so the user can manually recover.

The DB schema backup created by dbcore.Setup before any migration
remains the safety net for schema changes — no schema downgrade is
attempted because z-stream upgrades share the same schema version.

* PROJQUAY-13482: fix(omr): reduce run() complexity and check stop error in rollback

Extract deploy() and handleFailedUpgrade() from run() to bring
cyclomatic complexity under the gocyclo threshold of 15.

Return the stop error in rollbackUpgrade instead of ignoring it, so
the Quadlet is not rewritten while the upgraded container is still
running.

* PROJQUAY-13482: docs(omr): add Go doc comments to new upgrade rollback functions

* PROJQUAY-13482: fix(omr): always attempt rollback regardless of image tag match

Drop the previousImage != imageRef guard so rollback is attempted even
when the tag string is unchanged. Connected upgrades reuse the same
mutable tag (e.g. :latest) across releases, so comparing tag text
does not detect image content changes. Rollback with the same tag is
harmless — Podman restarts the container with whatever image the tag
currently resolves to.
2026-10-08 12:01:00 +00:00
..