I use the Build pipeline plugin when triggering a job from a pipeline script, like this, where I set the wait
condition to true since I want the job to finish before continuing.
build job: "some-multi-branch-pipeline/master",
parameters: [
string(name: "BUILD_NODE", value: buildNode),
booleanParam(name: "RUN_TESTS", value: env.RUN_TESTS.toBoolean()),
booleanParam(name: "RUN_SONAR", value: env.RUN_SONAR.toBoolean()),
booleanParam(name: "CONFIRM", value: confirm)
],
propagate: true,
wait: true
However, wait
doesn’t apply when triggering a scan on a multi-branch pipeline, which is done by simply triggering a build on the pipeline itself, like this
build job: "some-multi-branch-pipeline",
wait: true
I get the error
ERROR: Waiting for non-job items is not supported
So I resort to putting a sleep(120)
function after the scan to wait for 2 minutes for example. However I think it’s kludgy. Is there a way to programmatically check if the pipeline scan has finished?