I have setup a pipeline project similar to https://jenkins.io/doc/book/pipeline/syntax/#parallel-stages-example and it works fine.
But I have created the same project for different jobs, so rather than creating new jobs can I run for loop for all jobs e.g. jobs = [job1, job2, job3]
and run above pipeline code for different jobs.
Something similar to https://jenkins.io/doc/book/pipeline/syntax/#script-example
Can I use a for loop or similar logic to run a declarative pipeline?
I found similar question but not sure how to modify fo this Is it possible to create parallel Jenkins Declarative Pipeline stages in a loop?
Is it possible to create parallel Jenkins Declarative Pipeline stages in a loop?
Max's answer does it exactly how you want it ...Just copy the same thing and replace ["JobA", "JobB", "JobC"] to [job1, job2, job3] ...it will work – JeraldinejeraleeScripted Pipeline
syntax? If I'm usingdef
method, and I will have to add all declarative methods indef
method such asagent
,environment
etc. I thought you can't usedef
method with 1.3 syntax – Adjunctiondef call { pipeline {}}
I can't have otherdef
method, – Adjunction