JetBrains Space
 

Run Steps on Condition

Last modified: 15 December 2023

In some cases, it doesn't make sense to run all steps in a job for every single code change. Automation lets you control which steps within a job must be run based on specific conditions. For example, you might want to run different build steps depending on which branch of the code is being built, or you might want to skip certain steps when a change is made to a non-critical part of your code.

To add a condition to a step, use the job.container.runIf (or job.host.runIf) parameter. The runIf parameter accepts a string value. If the value is an empty string, false, or 0, the step is skipped. In all other cases, the step is executed.

Conditional steps are a perfect match for the customizable job parameters. Based on the user input, you can decide which steps to run. For example: