Ok, I think I see it now. Pipeline builds are WorkflowJob not AbstractProject, which is why it never reaches the line that schedules the next build.
And, I think I found a viable workaround. At the end of my pipeline script, use the http request plugin to issue a request to <my-jenkins-server>/git/notifyCommit?url=<my-repo>, triggering a poll which will start another execution of the job if it finds changes to build. Thanks for the help. Keith On Tuesday, October 6, 2020 at 6:13:01 PM UTC-4 Mark Waite wrote: > As far as I know, Pipeline can't be used that way. > > > On Tue, Oct 6, 2020 at 3:58 PM Keith Turner <[email protected]> wrote: > >> Yes, this is happening when there are changes on more than one branch. >> We have a single "Pipeline" job defined to run against all branches in our >> repo. Occasionally, there will be more than one branch with a change when >> the job is triggered by source control. Currently, we have to manually >> start the job again to run the job against the additional branch. >> >> How do I make a "Pipeline" job schedule additional executions >> automatically when multiple candidate revisions are found, like the >> freestyle job does? It seems like it should work out of the box and I see >> there's an extension (BuildSingleRevisionOnly) to disable that behavior. >> On Tuesday, October 6, 2020 at 5:02:29 PM UTC-4 Mark Waite wrote: >> >>> Multiple candidate revisions found was usually an indication that a >>> single job was defined to build multiple branches and it would switch from >>> one branch to the next as changes were detected in a specific branch. That >>> was all that Freestyle jobs could offer. It worked but the changes report >>> and the test results and other history items were unclear and very >>> difficult to interpret. If the previous build was from the same branch >>> >>> Jenkins Pipeline allows you to define a multibranch pipeline so that >>> Jenkins will automatically create a new job each time a branch is detected >>> and will automatically destroy the job when a branch is deleted. That >>> makes the history usable and simplifies the experience for users. >>> >>> On Tue, Oct 6, 2020 at 2:20 PM Keith Turner <[email protected]> wrote: >>> >>>> I've setup a test with a repository that has several branches. I >>>> created a freestyle jenkins job that uses Git SCM to checkout the repo. >>>> When I run this job, it shows the below and results in multiple executions >>>> of the job: >>>> >>>> Multiple candidate revisions >>>> Scheduling another build to catch up with <job name> >>>> Checking out Revision <id> (<branch>) >>>> >>>> I created a pipeline job, basically the same. It uses checkout, $class >>>> GitSCM and no extensions. When I run this job, it shows the below and >>>> does >>>> not schedule additional executions of the job: >>>> >>>> Multiple candidate revisions >>>> Checking out Revision <id> (<branch>) >>>> >>>> This is with Jenkins 2.235.5 and git-plugin 4.4.4, but this behavior >>>> has been consistent for some time. Is this a bug or do I need to do >>>> something differently to get the pipeline script to schedule additional >>>> executions of the job when multiple candidate revisions are found? >>>> >>>> thanks >>>> Keith >>>> >>>> -- >>>> 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 [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/jenkinsci-users/748a80e8-38c5-41da-80ae-c3e8089fa20cn%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/jenkinsci-users/748a80e8-38c5-41da-80ae-c3e8089fa20cn%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- >> 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 [email protected]. >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/jenkinsci-users/eae56b3c-d187-42e3-854f-f80664122bb9n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/jenkinsci-users/eae56b3c-d187-42e3-854f-f80664122bb9n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/75507b3e-ee62-41f1-aad2-d63461026a8cn%40googlegroups.com.
