Define Workflow Failure Strategy
A Failure Strategy defines how your Workflow handles different failure conditions.
In this topic:
Before You Begin
Step: Add Workflow Failure Strategy
To define the failure strategy for the entire Workflow, do the following:
- In a Workflow, click Failure Strategy. The default failure strategy appears.
The default failure strategy is to fail the Workflow if there is any application error, and to rollback the Workflow execution. You can modify the default strategy or additional strategies.
- Click Add Failure Strategy. The Failure Strategy settings appear.
The dialog has the following fields:
- Failure - Select the type of error:
- Connectivity Error: Harness is unable to connect to the target host/cluster/etc, or a provider, such as a Git repo.
- Authentication Error: Harness is unable to authenticate using the credentials you supplied in the Cloud Provider, Artifact Source, Source Repo Provider, and other connectors.
- Verification Error: If you have set up verification steps in your Workflow and a deployment event is flagged as an error by the step, Harness will fail the deployment.
- Application Error: Harness encountered an application error during deployment.
- Scope - Select the scope of the strategy. If you select Workflow, the Action is applied to the entire Workflow. If you select Workflow Phase, then the Action is applied to the Workflow Phase only.
For example, if you selected Workflow Phase and then selected the Action Rollback Phase Execution, and a failure occurred in the second Phase of the Workflow, then the second Phase of the Workflow would be rolled back but the first Phase of the Workflow would not be rolled back.
- Action - Select the action for Harness to take in the event of a failure, such as a retry or a rollback:
- Manual Intervention: You will be prompted to approve or reject the deployment on the Deployments page.
- Rollback Workflow Execution: Harness will initiate rollback.
- Rollback Phase Execution: Harness will initiate rollback of the Phase.
- Ignore: Harness ignores the failure and continues with deployment. This setting can confuse some users because the deployment will likely fail.
- Retry: Harness will retry the step where the failure occurred.
- End Execution: Harness will end the Workflow without rolling back.
- Abort Workflow: Harness will abort the Workflow without rolling back.
Step-level Custom Failure Strategy
To define the failure strategy for the step section of a Workflow, do the following:
- Next to the step section title, click the More Options ⋮ menu. The step-level settings appear.
- In Failure Strategy, click Custom. The Failure Strategy settings appear.
- Click Add Failure Strategy.
- Fill out the strategy. The dialog has the following fields:
- Failure - Select the type of error, such as Verification, Application, etc.
- Action - Select the action for Harness to take in the event of a failure, such as a retry or a rollback.
- Specific Steps - Select any specific Workflow steps that you want to target for the Failure Strategy. The criteria for the strategy will be applied to those steps only.`
There is no Scope setting, like the Scope setting in the Workflow-level Failure Strategy, because the scope of this strategy is the step section.
- Click Submit. The failure strategy is added to the step section.