Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save imranity/eea0a66392d5617293f24796e3da06b3 to your computer and use it in GitHub Desktop.

Select an option

Save imranity/eea0a66392d5617293f24796e3da06b3 to your computer and use it in GitHub Desktop.
// This example shows how to use nested conditions for `when` in jenkinsfile for declarative pipeline syntax
def skip_docker = true
pipeline {
agent any
{
stages {
stage('some stage') {
when {
allOf {
expression {
skip_docker == false
}
anyOf {
branch 'master'
branch 'skip_docker_build'
branch 'whatever'
}
}
}
}
}
}
// This stage will run if skip_docker is false AND branch is set to any of 'master' 'skip_docker_build' 'whatever'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment