> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/harness-platform/use-harness-platform/pipelines/failure-handling/define-a-failure-strategy-for-pipelines.md).

# Rollback pipelines

Configure pipeline rollback to roll back the entire pipeline upon stage or step failure.

Pipeline rollback is a type of [failure strategy](/harness-platform/use-harness-platform/pipelines/failure-handling/define-a-failure-strategy-on-stages-and-steps.md) that allows you to roll back the entire pipeline upon stage or step failure.

***

### What you will learn from this topic

* How to [configure a rollback failure strategy](#configure-a-rollback-failure-strategy) for your pipeline.

***

### Before you begin

* **Pipeline permissions:** You must have Execute permissions on pipelines to configure failure strategies. For more information, refer to [Manage roles](/harness-platform/use-harness-platform/platform-access-control/add-manage-roles.md).
* **Feature flag for non-CD stages:** Pipeline Rollback is available by default for Continuous Deployment (CD) steps and stages. For all other stages, pipeline rollback requires the feature flag `CDS_ALLOW_EXPRESSION_RESOLUTION_PIPELINE_ROLLBACK`. Contact [Harness Support](mailto:support@harness.io) to enable this feature flag.

***

### Configure a rollback failure strategy

Perform the following steps to configure a rollback failure strategy for a step or stage:

1. In your pipeline, navigate to the step or stage where you want the rollback strategy to be triggered if that step or stage fails.
2. Click **Advanced**.
3. Under **Failure Strategy**, locate **On failure of type**, and select the [error type](/harness-platform/use-harness-platform/pipelines/failure-handling/define-a-failure-strategy-on-stages-and-steps.md#error-types) that you want to trigger the rollback.
4. Under **Perform Action**, select **Rollback Pipeline**.

![](https://173309742-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3F2TpHXhur2QtQnORSM9%2Fuploads%2Fgit-blob-9823ddb550a57a8c7ad7fcb3bc4941e2a8300e65%2Frollback-pipeline.png?alt=media)

The following YAML example shows a pipeline rollback failure strategy that triggers on any error:

```yaml
failureStrategies:
  - onFailure:
      errors:
         - AllErrors
      action:
         type: PipelineRollback
```

During pipeline execution, if the failure event occurs that triggers the rollback failure strategy, all steps and stages are rolled back accordingly.

{% hint style="warning" %}
If a pipeline uses [pipeline chaining](/harness-platform/use-harness-platform/pipelines/pipeline-chaining.md) (where one or more stages are actually other pipelines), rolling back the parent pipeline does not roll back the child pipeline, because the child pipeline is considered a separate pipeline execution. In such cases, only the deployment stages of the parent pipeline roll back.
{% endhint %}

***

### Next steps

* [Define a failure strategy on stages and steps](/harness-platform/use-harness-platform/pipelines/failure-handling/define-a-failure-strategy-on-stages-and-steps.md): Configure other failure strategy actions for stages and steps.
* [Mark pipeline as failed](/harness-platform/use-harness-platform/pipelines/failure-handling/mark-as-failed-pipeline.md): Manually mark a running pipeline as failed to trigger failure handling.

{% @harness-feedback/feedback module="harness-ai" pagePath="harness-ai/use-harness-platform/pipelines/failure-handling/define-a-failure-strategy-for-pipelines" %}
