Is it possible to create parallel Jenkins Declarative Pipeline stages in a loop?
问题 I have a list of long running Gradle tasks on different sub projects in my project. I would like to run these in parallel using Jenkins declarative pipeline. I was hoping something like this might work: projects = [":a", ":b", ":c"] pipeline { stage("Deploy"){ parallel { for(project in projects){ stage(project ) { when { expression { someConditionalFunction(project) } } steps { sh "./gradlew ${project}:someLongrunningGradleTask" } } } } } } Needless to say that gives a compile error since it