I have a Groovy script as part of a Jipkins Pipeline job, as shown below:
node { stage('Testing') { build job: 'Test', parameters: [string(name: 'Name', value: 'Foo1')], quietPeriod: 2, wait: false build job: 'Test', parameters: [string(name: 'Name', value: 'Bar1')], quietPeriod: 2, wait: false build job: 'Test', parameters: [string(name: 'Name', value: 'Baz1')], quietPeriod: 2, wait: false build job: 'Test', parameters: [string(name: 'Name', value: 'Foo2')], quietPeriod: 2, wait: false build job: 'Test', parameters: [string(name: 'Name', value: 'Bar2')], quietPeriod: 2, wait: false build job: 'Test', parameters: [string(name: 'Name', value: 'Baz2')], quietPeriod: 2, wait: false } }
which performs several other freestyle jobs in parallel, because the wait flag is set to false . However, I would like the caller's job to end when all jobs have been completed. Currently, the Pipeline task starts all the tasks and finishes it in a few seconds, which is not what I want, because I canβt keep track of the total time, and I donβt have the ability to cancel all the running tasks in one go.
How can I fix the above script to complete the Pipeline job when all parallel jobs are complete?
I tried to complete the build jobs in the waitUntil {} block, but that didn't work.