I'm using multibranch pipelines projects in Jenkins.
I let Jenkins index new branches.
I need Jenkins to wait until indexing of a multibranch pipeline project is complete.
This is my current code:
def triggerScanMultibranchPipeline(projectDir, repo) {
def multibranchProject = Jenkins.instance.getItemByFullName "$projectDir/$repo"
multibranchProject.scheduleBuild()
while (multibranchProject == null || multibranchProject.isDisabled()) {
sleep 1000 //1000 milliseconds = 1 second
}
sleep time: 1, unit: 'SECONDS'
}
Already tried:
* change (second) sleep to 30 seconds
This increases duration of the build each time `triggerScanMultibranchPipeline` is called.
I cannot use `"wait: true"` for the indexing to complete, because waiting for non-job items is not supported.
How can I let Jenkins wait until the branch indexing of the Multibranch Pipeline Project is complete?