Execute the stage when the specified Groovy expression evaluates to true, for example: when { expression { return params.DEBUG_BUILD } } 

## not 

Execute the stage when the nested condition is false. Must contain one condition. For example: when { not { branch 'master' } } 

## allOf 

Execute the stage when all of the nested conditions are true. Must contain at least one condition. 

For example: when { allOf { branch 'master'; environment name: 'DEPLOY_TO', value: 'production' } } 

## anyOf 

Execute the stage when at least one of the nested conditions is true. Must contain at least one condition. For example: when { anyOf { branch 'master'; branch 'staging' } } 

## Examples 

// Declarative // pipeline { agent any stages { stage('Example Build') { steps { echo 'Hello World' } } stage('Example Deploy') { when { branch 'production' } steps { echo 'Deploying' } } } } // Script // 

