Skip to content

feat(pipeline): add image-only deployment rollback#45

Merged
wellCh4n merged 5 commits into
wellCh4n:mainfrom
microbluey:feat/pipeline-rollback
May 30, 2026
Merged

feat(pipeline): add image-only deployment rollback#45
wellCh4n merged 5 commits into
wellCh4n:mainfrom
microbluey:feat/pipeline-rollback

Conversation

@microbluey
Copy link
Copy Markdown
Contributor

What

Roll back a deployment to a previous pipeline's image without rebuilding.

A rollback creates a new Pipeline record (preserving history) marked with triggerType=ROLLBACK and rollbackFromPipelineId, copies the historic artifact, skips the build step, and deploys straight through the existing artifact deploy chain.

Runtime spec, service config, and the env-var ConfigMap stay at the application's current values (12-factor: config decoupled from release). Full config rollback is deliberately out of scope for this first version.

Backend

  • New PipelineTriggerType {BUILD, ROLLBACK} enum + triggerType / rollbackFromPipelineId fields on Pipeline (domain + JPA), Flyway V10 migration defaulting existing rows to BUILD.
  • Pipeline.rollback() factory; opened state-machine edge INITIALIZED → DEPLOYING (rollback skips RUNNING/BUILD_SUCCEEDED).
  • PipelineService.rollback() and POST .../pipelines/{id}/rollback endpoint.
  • ApplicationRuntimeGateway.findCurrentImage() + K8s impl, exposed via GET .../applications/{name}/current-image?env= to highlight the live version.
  • PipelineDto exposes triggerType + rollbackFromPipelineId.

Frontend

  • Rollback button (SUCCEEDED pipelines with an artifact that aren't currently live), confirm dialog, "live version" highlight, and rollback badge on the pipelines page.
  • rollbackPipeline() / getCurrentImage() API clients; i18n across all 4 locales.

Tests

PipelineStateMachineTests + PipelineRollbackTests — 10 tests, all green. Frontend pnpm build passes.

Notes

  • Permission reuses isAuthenticated() — collaborators can roll back, consistent with deploy.
  • No image-existence pre-check; rollback behaves identically to a normal deploy (server-side apply reports SUCCEEDED immediately).
  • Post-deploy health verification (detecting ImagePullBackOff / not-ready after apply) is a platform-wide concern and is intentionally deferred to a separate PR.

Roll back a deployment to a previous pipeline's image without rebuilding.
Rollback creates a new Pipeline record (preserving history) marked with
triggerType=ROLLBACK and rollbackFromPipelineId, copies the historic
artifact, skips the build step, and deploys straight through the existing
artifact deploy chain. Runtime spec, service config, and env-var ConfigMap
stay at the application's current values (12-factor: config decoupled from
release); full config rollback is deliberately out of scope.

Backend:
- new PipelineTriggerType {BUILD, ROLLBACK} enum + triggerType /
  rollbackFromPipelineId fields on Pipeline (domain + JPA), Flyway V10
  migration defaulting existing rows to BUILD
- Pipeline.rollback() factory; open state machine edge INITIALIZED -> DEPLOYING
- PipelineService.rollback() and POST .../pipelines/{id}/rollback endpoint
- ApplicationRuntimeGateway.findCurrentImage() + K8s impl, exposed via
  GET .../applications/{name}/current-image?env= to highlight the live version
- PipelineDto exposes triggerType + rollbackFromPipelineId

Frontend:
- rollback button (SUCCEEDED pipelines with an artifact that aren't live),
  confirm dialog, "live version" highlight, and rollback badge on the
  pipelines page
- rollbackPipeline() / getCurrentImage() API clients; i18n in all 4 locales

Tests: PipelineStateMachineTests + PipelineRollbackTests (10 tests).
Move the rollback indicator out of the ID column into its own "Type"
column on the pipelines table: BUILD renders a "Build" badge, ROLLBACK
renders a "Rollback" badge, so normal builds are labelled explicitly
instead of showing nothing. The "live version" highlight stays in the
ID column. i18n added for all 4 locales.
Render the pipeline Type column as an icon + text (Rocket "Build" /
Undo2 "Rollback") instead of badges, so it no longer competes visually
with the adjacent Status badge. Rollback rows get a dotted-underline
hover tooltip showing the source pipeline id (rollbackFromPipelineId)
for traceability. i18n added for all 4 locales.
Drop the muted color on the Build label so Build and Rollback share the
normal foreground color, consistent with the other columns. Replace the
dotted-underline hover affordance with a small Info icon next to the
Rollback label; hovering it shows the source pipeline id.
@wellCh4n wellCh4n merged commit 92abc2b into wellCh4n:main May 30, 2026
@wellCh4n
Copy link
Copy Markdown
Owner

lgtm

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.

2 participants