Using Skip Conditions to Control Pipeline Execution

Howdy gang :vulcan_salute:

Harness pipelines allow you to define a sequence of stages that perform specific tasks, such as building, testing, and deploying your application. Often, it is useful to control when a stage is executed based on certain conditions, such as the success or failure of a previous stage or the value of a specific variable. In this article, we will show you how to use a skip condition to execute a stage only if a specific condition is met.

Step 1: Export a Variable from a Previous Stage

The first step in using a skip condition is to export a variable from a previous stage. This variable can indicate whether or not a specific condition has been met. For example, if you have a validation step in a stage before the Jira Creation stage, you can export a variable with the value defined based on the validation results.

To export a variable, add an “Export Variable” step to your stage and specify the name and value of the variable. You can use expressions and functions to compute the variable’s value based on other variables or outputs from previous steps.

Doc Reference:

Step 2: Define a Skip Condition in the Subsequent Stage

The next step is to define a skip condition in the subsequent Jira stage. A skip condition is a Boolean expression determining whether the stage should be executed or skipped. In our example, we want the Jira stage to be skipped if the validation step in the previous stage fails.

To define a skip condition, click on the Jira stage in your pipeline and then click on the “Advanced” tab. Under “Conditional Execution” in the “And execute this step only if the following JEXL Condition evaluates to true” option, enter a Boolean expression that evaluates to true or false. You can use the exported variable and other variables in the expression and logical and comparison operators.

Doc Reference:

Step 3: Test and Refine the Skip Condition

Once you have defined the skip condition, save your pipeline and run a test execution to see if the Jira stage is skipped when the condition is not met. You can also check the logs and output variables to verify that the exported variable has the correct value.

If the skip condition does not work as expected, you can refine the Boolean expression or adjust the previous stage to export a different variable.


Using skip conditions is a powerful way to control the execution of stages in your Harness pipelines based on specific conditions. By exporting variables and defining skip conditions, you can ensure that your pipeline runs only when all the necessary conditions are met, reducing errors and speeding up deployments. To learn more about using skip conditions and other advanced features in Harness, check out our documentation and tutorials.