Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hayderimran7/eea0a66392d5617293f24796e3da06b3 to your computer and use it in GitHub Desktop.
Save hayderimran7/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