Jenkins declarative pipeline 1.3 run parallel for

2019-08-22 02:44发布

问题:

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?