How to make Pipeline job to wait for all triggered parallel jobs?
<p>I've Groovy script as part of the Pipeline job in Jenkins as below:</p>

<pre><code>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
    }
}
</code></pre>

<p>which executes multiple other freestyle jobs in parallel, because of <code>wait</code> flag being set to <code>false</code>. However I'd like for the caller job to finish when all jobs are finished. Currently the Pipeline job triggers all the jobs and finishes it-self after few seconds which is not what I want, because I cannot track the total time and I don't have ability to cancel all triggered jobs at one go.</p>

<p>How do I correct above script for Pipeline job to finish when all jobs in parallel are completed?</p>

<p>I've tried to wrap build jobs in <code>waitUntil {}</code> block, but it didn't work.</p>