A Jenkins pipeline is broken up into various stages. Each stage can be triggered conditionally using the when {} directive and listing some conditions. For example, to trigger a stage only on the main branch, the pipeline would look something like this:
Multiple conditions can be added by creating new lines inside the when {} block. All conditions must evaluate to true for the stage to run. A few further possible conditions include:
A Jenkins pipeline is broken up into various stages. Each stage can be triggered conditionally using the
when {}
directive and listing some conditions. For example, to trigger a stage only on the main branch, the pipeline would look something like this:Multiple conditions can be added by creating new lines inside the
when {}
block. All conditions must evaluate to true for the stage to run. A few further possible conditions include:There are many others beyond this. The Jenkins Pipeline Syntax Docs are a good resource for more detailed info.