How do I roll back my deployment in
Automation PipelinesLast Updated February 19, 2025
Automation Pipelines
You configure rollback as a pipeline
with tasks that return your deployment to a previous stable state following a failure in a
deployment pipeline. To roll back if a failure occurs, you attach the rollback pipeline to
tasks or stages.
- Verify that you are a member of a project inAutomation Pipelines. If you are not, ask aAutomation Pipelinesadministrator to add you as a member of a project. See How do I add a project in Automation Pipelines.
- Set up the Kubernetes clusters where your pipeline will deploy your application. Set up one development cluster and one production cluster.
- Verify that you have a Docker registry setup.
- Identify a project that will group all your work, including your pipeline, endpoints, and dashboards.
- Familiarize yourself with the CD smart template as described in the CD portion of Planning a CICD native build in Automation Pipelines before using the smart pipeline template, for example:
- Create the Kubernetes development and production endpoints that deploy your application image to the Kubernetes clusters.
- Prepare the Kubernetes YAML file that creates the Namespace, Service, and Deployment. If you need to download an image from a privately-owned repository, the YAML file must include a section with the Docker config Secret.
Depending upon your role, your reasons for
rollback might vary.
- As a release engineer, I wantAutomation Pipelinesto verify success during a release so that I can know whether to continue with the release or roll back. Possible failures include task failure, a rejection in UserOps, exceeding the metrics threshold.
- As an environment owner, I want to redeploy a previous release so that I can quickly get an environment back to a known-good state.
- As an environment owner, I want to support roll back of a Blue-Green deployment so that I can minimize downtime from failed releases.
When you use a smart pipeline template to
create a CD pipeline with the rollback option clicked, rollback is automatically
added to tasks in the pipeline. In this use case, you will use the smart pipeline
template to define rollback for an application deployment to a Kubernetes cluster
using the rolling upgrade deployment model. The smart pipeline template creates a
deployment pipeline and one or more rollback pipelines.
- In the deployment pipeline, rollback is required if Update Deployment or Verify Deployment tasks fail.
- In the rollback pipeline, deployment is updated with an old image.
You can also manually create a rollback
pipeline using a blank template. Before creating a rollback pipeline, you will want
to plan your rollback flow. For more background information about rollback, see
Planning for rollback in Automation Pipelines.
- Click.
- Enter the information in the smart pipeline template.
- Select a project.
- Enter a pipeline name such asRollingUpgrade-Example.
- Select the environments for your application. To add rollback to your deployment, you must selectProd.
- ClickSelect, choose a Kubernetes YAML file, and clickProcess.The smart pipeline template displays the available services and deployment environments.
- Select the service that the pipeline will use for the deployment.
- Select the cluster endpoints for the Dev environment and the Prod environment.
- For the Image source, selectPipeline runtime input.
- For the Deployment model, selectRolling Upgrade.
- ClickRollback.
- Provide theHealth check URL.
- To create the pipeline named RollbackUpgrade-Example, clickCreate.The pipeline named RollbackUpgrade-Example appears, and the rollback icon appears on tasks that can roll back in the Development stage and the Production stage.
- Close the pipeline.On the Pipelines page, the pipeline that you created appears, and a new pipeline for each stage in your pipeline appears.
- RollingUpgrade-Example.Automation Pipelinesdeactivates the pipeline that you created by default, which ensures that you review it before you run it.
- RollingUpgrade-Example_Dev_Rollback. Failure of tasks in the development stage, such asCreate service,Create secret,Create deployment, andVerify deploymentinvoke this rollback development pipeline. To ensure the rollback of development tasks,Automation Pipelinesactivates the rollback development pipeline by default.
- RollingUpgrade-Example_Prod_Rollback. Failure of tasks in the production stage, such asDeploy phase 1,Verify phase 1,Deploy Rollout phase,Finish Rollout phase, andVerify rollout phaseinvoke this rollback production pipeline. To ensure the rollback of production tasks,Automation Pipelinesactivates the rollback production pipeline by default.
- Enable and run the pipeline you created.When you start the run,Automation Pipelinesprompts you for input parameters. You provide the image and tag for the endpoint in the Docker repository that you are using.
- On the Executions page, selectand watch the pipeline execution.The pipeline startsRUNNINGand moves through the Development stage tasks. If the pipeline fails to run a task during the Development stage, the pipeline named RollingUpgrade-Example_Dev_Rollback triggers and rolls back the deployment, and the pipeline status changes toROLLING_BACK.After rollback, the Executions page lists two RollingUpgrade-Example pipeline executions.
- The pipeline you created rolled back and displaysROLLBACK_COMPLETED.
- The rollback development pipeline that triggered and performed the rollback displaysCOMPLETED.
Congratulations! You successfully
defined a pipeline with rollback and watched
Automation Pipelines
roll back the pipeline at the point of failure.