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.
See 
https://github.com/jenkinsci/pipeline-build-step-plugin/blob/pipeline-build-step-2.13/src/main/java/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStepExecution.java#L80

How can I let Jenkins wait until the branch indexing of the Multibranch 
Pipeline Project is complete?

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/c1131785-c31d-427d-b0e7-b16e7873d2e7n%40googlegroups.com.

Reply via email to