Created
August 3, 2020 15:20
-
-
Save mkutz/7e20f8697e33e1acff1c5d0f93632c4d to your computer and use it in GitHub Desktop.
Jenkinsfile using parallel and when to exceute either the one or the other stage
This file contains hidden or 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
#!/usr/bin/env groovy | |
// see https://jenkins.io/doc/book/pipeline/syntax/ | |
pipeline { | |
agent any | |
parameters { | |
booleanParam(name: "RELEASE", defaultValue: false) | |
} | |
stages { | |
stage("Build") { | |
steps { | |
sh "./gradlew build" | |
} | |
} | |
stage("Publish") { | |
parallel { | |
stage("Release") { | |
when { expression { params.RELEASE } } | |
steps { | |
sh "./gradlew release" | |
} | |
} | |
stage('Pre-Release') { | |
when { expression { !params.RELEASE } } | |
steps { | |
sh "./gradlew preRelease" | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment