Skip to content

Instantly share code, notes, and snippets.

@kagarlickij
Created March 30, 2018 10:13
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 kagarlickij/a64ed30609f318efa8044fc5e31f887d to your computer and use it in GitHub Desktop.
Save kagarlickij/a64ed30609f318efa8044fc5e31f887d to your computer and use it in GitHub Desktop.
This is demo pipeline to check IF conditions in declarative way
pipeline {
agent any
stages {
stage ('First') {
steps {
echo "First"
}
}
if (env.BRANCH_NAME == 'master') {
echo 'First stage is enought, exit 0 shoul happened here'
currentBuild.result = 'SUCCESS'
return
} else {
echo 'Second and third stages must be executed'
}
stage('Second') {
steps {
echo "Second"
}
}
stage('Third') {
steps {
echo "Third"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment