Pipeline job doesn't schedule additional builds for multiple candidate revisions

19 views
Skip to first unread message

Keith Turner

unread,
Oct 6, 2020, 4:20:40 PM10/6/20
to Jenkins Users
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

Mark Waite

unread,
Oct 6, 2020, 5:02:29 PM10/6/20
to Jenkins Users
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.

--
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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/748a80e8-38c5-41da-80ae-c3e8089fa20cn%40googlegroups.com.

Keith Turner

unread,
Oct 6, 2020, 5:58:09 PM10/6/20
to Jenkins Users
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.

Mark Waite

unread,
Oct 6, 2020, 6:13:01 PM10/6/20
to Jenkins Users
As far as I know, Pipeline can't be used that way.  


Keith Turner

unread,
Oct 6, 2020, 9:07:43 PM10/6/20
to Jenkins Users
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
Reply all
Reply to author
Forward
0 new messages