Skip to content

Instantly share code, notes, and snippets.

@afischer211
Last active March 4, 2021 15:44
Show Gist options
  • Select an option

  • Save afischer211/90d4fa9455c20213f3332011b3ee28a2 to your computer and use it in GitHub Desktop.

Select an option

Save afischer211/90d4fa9455c20213f3332011b3ee28a2 to your computer and use it in GitHub Desktop.
Multiple sequential stages #Jenkins #Pipeline #Groovy
#!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