Last active
March 4, 2021 15:44
-
-
Save afischer211/90d4fa9455c20213f3332011b3ee28a2 to your computer and use it in GitHub Desktop.
Multiple sequential stages #Jenkins #Pipeline #Groovy
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
| #!groovy | |
| pipeline { | |
| agent { label 'docker' } | |
| stages { | |
| stage('Multiple Stages') { | |
| steps { | |
| script { | |
| def stages = readYaml text:""" | |
| stages: | |
| - one | |
| - two | |
| - three | |
| """ | |
| for(int i = 0; i<stages.stages.size(); i++){ | |
| assert stages.stages[i] != null | |
| stage("${stages.stages[i]}") { | |
| echo "Running stage stages.stages[i]}" | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment