Created
March 30, 2018 10:13
-
-
Save kagarlickij/a64ed30609f318efa8044fc5e31f887d to your computer and use it in GitHub Desktop.
This is demo pipeline to check IF conditions in declarative way
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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