Skip to content

Instantly share code, notes, and snippets.

@freme
Last active December 18, 2017 15:17
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 freme/50d6263b25ca199f718b8b2f3d6ad732 to your computer and use it in GitHub Desktop.
Save freme/50d6263b25ca199f718b8b2f3d6ad732 to your computer and use it in GitHub Desktop.
minimal Jenkinsfile to show that when directive does not prevent stage from being executed, only the steps, which means that the agent is still needed
pipeline{
agent none
stages{
stage('linux') {
when { expression {false} }
agent { label 'default' }
steps { echo 'LINUX' }
}
}
}
Console Output
Started by user Admin
[Pipeline] stage
[Pipeline] { (linux)
[Pipeline] node
Running on jenkins-agent-default in /jenkins_agent/workspace/example-pipeline
[Pipeline] {
Stage 'linux' skipped due to when conditional
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] End of Pipeline
Finished: SUCCESS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment