For the complete documentation index, see llms.txt. This page is also available as Markdown.

Post-deployment rollback

Rollback your most recent successful deployment.

This feature is in Beta and requires enablement. View all early access features.

Post-deployment rollback reverts your most recent successful deployment. This allows rapid, predictable recovery after a deployment that met technical criteria, even if you want to roll back for other reasons.

What you will learn from this topic

Before you begin

  • Post-deployment rollback is supported for the following deployment types only:

    • Kubernetes

    • AWS Auto Scale Group (ASG)

    • Tanzu Application Services (TAS)

    • Amazon Elastic Container Service (ECS)

    • Native Helm

    • Google Managed Instance Group (MIG)

      Harness anticipates expanding this feature to other deployment types in the future.

  • Alternatively, for unsupported deployment types such as SSH deployments, users can retrieve the previous version and create a new forward deployment using the required artifact version and manifest.

  • You can roll back only successful pipelines. The rollback option is not available for failed pipelines.

  • Only the rollback steps that are part of the stage can be used during rollback.

  • You cannot roll back the same pipeline more than once. You can perform a rollback if the pipeline is executed again.

  • If the pipeline configuration has changed between executions, the previous execution's YAML is used as a reference for rolling back.

  • Rollback steps can use expressions that refer to steps executed during the previous pipeline execution. The expressions are automatically resolved with values from the original execution.

  • The stages should roll back in reverse order when deployment rollback is triggered.

  • Rolling back to a previous post-production deployment is only possible for executions that occurred within the past 30 days.

  • You cannot roll back an execution if it is marked successful by the ignore failures failure strategy.

Roll back deployments at the project level

For post-deployment rollback, Harness assumes you have created a pipeline with multiple deployments so the rollback steps can revert the pipeline to the last successful deployment.

For more details on creating a pipeline, go to Create your first CD pipeline.

  1. In Summary, in the Environments & Groups panel, select the deployment you want to roll back, and then select the instances link.

    Here is an example pipeline where the artifact library/nginx:stable-perl is deployed first, and library/nginx:stable-bullseye-perl is deployed next.

  2. In Instance Details, select Rollback.

    Here, you are rolling back the deployed instance with the artifact library/nginx:stable-bullseye-perl to the previously deployed instance with the artifact library/nginx:stable-perl.

  3. In the Rollback infrastructure dialog, select Confirm.

    The pipeline execution for the rollback stage appears in a new tab.

    Once the rollback is complete, your deployed instances will revert to their state before the most recent deployment.

Permissions required for project-level rollback

To perform post-deployment rollback, the user must have the following permissions:

  1. Pipeline Execute permission.

  2. Environment Rollback permission.

A user will be allowed to execute rollbacks on any instance only if they possess these two specified permissions for the pipeline and environment through which the deployment occurred. Otherwise, they will see the following message when they click Rollback.

Roll back deployments at the account level and organization level

Users can perform service rollbacks at both the account and organization levels using Service Dashboards.

  1. For an account-level overview, go to Account Settings -> Services. For an organization-level overview, go to Organization Settings -> Services.

  2. Select the service for which you want to perform a rollback. You can also use the search bar to simplify your search.

  3. In the Summary tab, you can view all the service deployments performed at the account or organization level.

  1. To distinguish between environments, hover over the Organization/Project on the card to view the service deployment's org_id and project_id. You can view the deployments in the Environment, Artifacts, or Charts view.

  2. Click View Instance and Rollback. All executions are displayed along with their environment details. You can only perform a rollback in the Environment view.

  3. Select the deployment for which the rollback is to be performed, and click Confirm to initiate the rollback.

You will be directed to the pipeline execution page, and the Rollback Rollout Step will be executed.

Similarly, users can perform service rollbacks at both the account and organization levels in Environment Dashboards by following the same procedures.

  1. For an account-level overview, go to Account Settings -> Environments. For an organization-level overview, go to Organization Settings -> Environments.

The remaining steps are the same as those outlined for the Service Dashboards.

Permissions required for the account and organization-level rollback

To perform a post-deployment rollback, the user must have the following permissions:

  1. Pipeline Execute permission for the specific pipeline.

  2. Environment Rollback permission.

A user is allowed to execute rollbacks on any instance only if they possess these two permissions for the pipeline and environment through which the deployment occurred. Otherwise, they see the following message when attempting to click Rollback.

Roll back multiple infrastructures in a single action

This feature is behind the feature flag CDS_BULK_POST_PROD_ROLLBACK. The feature flag CDC_SERVICE_DASHBOARD_REVAMP_NG is also required as a prerequisite. Contact Harness Support to enable the feature.

A single service is often deployed across multiple environments and infrastructure types simultaneously. When you need to revert that service across all of them, rolling back the infrastructure one by one is slow. Bulk rollback lets you select multiple infrastructures on the service dashboard and trigger a rollback for all of them in a single action.

Harness processes each selected infrastructure independently. If the rollback for one infrastructure fails, the remaining infrastructures still roll back, and Harness reports the outcome for each target separately.

Roll back multiple infrastructures

To roll back a service across multiple infrastructures at once, do the following:

  1. Open your services dashboard and select the service you want to roll back.

  2. In Summary, select the instances link to open the Bulk Rollback - Instance details view. This view lists every environment and infrastructure where the service is deployed, along with the environment type, infrastructure, chart version, artifact, and instance count for each row.

  3. Select the checkbox next to each infrastructure you want to roll back. You can use the search bar to filter the list when the service is deployed to many infrastructures.

  4. To review the deployed instances for a row before you select it, select the view icon in the Action column. The Instance Details panel shows the pod, artifact, container list, namespace, release name, and deployment metadata for that infrastructure.

  5. Select Rollback selected.

  6. In the Confirm Rollback dialog, review each infrastructure and its current artifact. For every infrastructure, select the execution to use for the rollback under Select Execution to Use for Rollback. Each execution card shows the instances, artifact, infrastructure, and deployment details for that execution, so you can confirm the target state before you proceed.

  7. Select Confirm Rollback.

Harness triggers a rollback execution for each selected infrastructure and reports how many rollbacks were triggered and how many failed. You can track the progress of each rollback from its pipeline execution view.

Permissions required for bulk rollback

The permissions for bulk rollback are the same as for a single post-deployment rollback. For each infrastructure you select, you need Pipeline Execute permission on the pipeline that performed the deployment and Environment Rollback permission on the target environment. Harness skips any infrastructure for which you do not have both permissions and reports it as a failed target in the response.

Pipeline-level service rollback

This feature is behind the feature flag CDS_ROLLBACK_OPTION. Contact Harness Support to enable the feature.

The Service Rollback feature initiates rollbacks directly from pipeline execution pages. Instead of navigating through instance details to find the rollback option, you can start the rollback process with a dedicated Rollback button.

This streamlined experience is available across multiple execution views:

Pipeline Execution Listing Page

View all pipeline executions in a consolidated list format. The Rollback option is available for each successful deployment execution. Click the three dots menu to the left of the execution to access the rollback option.

Click to view full size image

Pipeline Execution Summary Page

Detailed view of a specific pipeline execution with all its stages and steps. Access rollback directly from the execution summary by clicking the Rollback button at the top right corner of the page.

Click to view full size image

Execution History Page

Comprehensive history of all executions with filtering and search capabilities. Quickly identify and rollback any deployment. Click the three dots menu to the left of the execution to access the rollback option.

Click to view full size image

Service rollback

Perform the following steps to rollback a service:

  1. Navigate to any of the execution views described above and locate your deployment.

  2. Initiate the rollback:

    • From Pipeline Execution Listing or History Page: Click the three dots menu next to the execution

    • From Pipeline Execution Summary: Click the Rollback button in the top right corner

    Select Service Rollback from the menu options. A step wizard opens to guide you through the process.

  3. Select Service: In the first step of the wizard, select the service you want to roll back using the radio button option, then click Next.

Click to view full size image
  1. Select Environment: In the second step, you will see a table that groups deployment instances by environment, along with details such as group, type, infrastructure, artifact, and chart version. Each row represents a specific deployment state. Select the instance you want to roll back to, then click Next.

Click to view full size image

The blue-highlighted box shows pipeline executions where this service was deployed. Select the execution you want to roll back to. On the right, you will see the instances deployed in that execution. There can be one or multiple instances depending on how the service was deployed in that particular execution. In this example, the selected execution deployed one instance, but other executions might have deployed multiple instances.

Click to view full size image
  1. Confirm Rollback: In the final step, review your selections:

    • Service name

    • Environment name

    • Infrastructure identifier

Click to view full size image

Click Confirm to initiate the rollback.

  1. Once confirmed, Harness begins the rollback. The wizard closes, and you are redirected to the execution page, where you can monitor the rollback progress.

Click to view full size image

The rollback will begin immediately, and you can track its progress in real time through the pipeline execution view.

Rollback using API

You can roll back deployments programmatically using Harness APIs. For more information, go to Harness API Documentation.

To roll back multiple services, environments, and infrastructure targets in a single request, go to the batch rollback API reference.

Next steps

Last updated

Was this helpful?