Skip to content

Add rollback deployment command

Placeholder ppxd requested to merge feat/deployment-rollback-command into main

Summary

  • RollbackDeploymentCommand rolls an environment back to a prior release by re-deploying it through the existing deployment pipeline — a rollback is a normal deployment of an older release, so there is no new deployment flag and no schema change.
  • Target resolution uses the deployment journal (built in #382): the previous successful release by default, or an operator-specified prior release validated against the environment's success history (rejects the current release, an unknown release, or an environment with no prior release).
  • The action delegates to DeploymentService.CreateDeploymentAsync, reusing all preview/validation, snapshotting and enqueueing — no parallel deploy path. POST /api/deployments/rollback exposes it; carries DeploymentCreate permission.

Test plan

  • Unit (RollbackServiceTests, 7): auto target → previous distinct release; explicit valid target honoured; environment + redeploy flags propagated; rejects current / unknown / absent / single-release targets without deploying (mocked journal + IDeploymentService)
  • Integration vs Postgres (RollbackDeploymentTests, 5): auto + explicit success paths resolve the correct release from the real journal and pass it into the standard deploy command (stubbed deploy boundary); single-release / current-release / unknown-release rejections throw through the real service
  • Full unit suite green (5639), full solution builds clean

Together with #382 (resolver: unit + integration) this gives the rollback feature unit + integration coverage; the deploy path it reuses (CreateDeploymentAsync) is already covered by the existing deployment E2E suite.

Merge request reports

Loading