Creating a new job by cloning an existing one triggers a rebuild of all branches of the cloned job

6 views
Skip to first unread message

Francois Marot

unread,
Apr 22, 2020, 9:46:48 AM4/22/20
to Jenkins Users
Hello, I usually create new jobs (multibranch pipelines) by cloning existing ones.
I recently discovered that in my current Jenkins version, the behavior has changed and as soon as you hit the "OK" button on the job creation page, it triggers a rebuild of all the branches of the existing project !
Rather inconvenient !

I use Jenkins ver. 2.204.3

To reproduce, go to the main page, then "new item", enter a new item name ("foo") then at the bottom of the page (*) choose to clone an existing project "bar" then hit ok.
=> all bar branches will be built with a new job "foo", despite foo creation not being completly finished.

Is it a new known behavior ? Do I need to open a bug or is it corrected in later versions ?

Regards

Francois

(*) option is labelled: "If you want to create a new item from other existing, you can use this option:"

Mark Waite

unread,
Apr 22, 2020, 10:35:20 AM4/22/20
to Jenkins Users


On Wednesday, April 22, 2020 at 7:46:48 AM UTC-6, Francois Marot wrote:
Hello, I usually create new jobs (multibranch pipelines) by cloning existing ones.
I recently discovered that in my current Jenkins version, the behavior has changed and as soon as you hit the "OK" button on the job creation page, it triggers a rebuild of all the branches of the existing project !
Rather inconvenient !

I use Jenkins ver. 2.204.3

To reproduce, go to the main page, then "new item", enter a new item name ("foo") then at the bottom of the page (*) choose to clone an existing project "bar" then hit ok.
=> all bar branches will be built with a new job "foo", despite foo creation not being completly finished.

Is it a new known behavior ? Do I need to open a bug or is it corrected in later versions ?


I don't understand your description of the issue.  I think you said the steps were:
  1. Click "New item" to begin creating a new job
  2. Enter the name of the new item, "foo", in the item name field
  3. Enter the name of an existing multibranch pipeline project, "bar" in the "Copy from" field
  4. Hit the "Ok" button
Those steps completely create the new project "foo" that is a copy of "bar".  Immediately after "foo" is created, the repository is scanned and jobs are created for each branch that contains a Jenkinsfile.

However, you then said

=> all bar branches will be built with a new job "foo", despite foo creation not being completly finished.
 
Can you expand further what you mean when you say that "foo creation [is] not completely finished"?  It seems to me based on your description of the steps that foo creation is completely finished when you press the "Ok" button.  Jenkins places you into the job configuration page after creating the job so that you can make additional changes, but the job is defined once the "Ok" button is pressed.

I confirmed with Jenkins 2.222.2-rc that the copied multibranch project does not exist until the OK button is pressed.  Once the OK button is pressed, then the copied multibranch project exists and immediately indexes the branches even while the job configuration editing page is open.

The creation workflow places you in the job configuration page for the new multibranch pipeline so that you can edit the existing job definition.  You indicate that the repository scanning is a new behavior that was previously delayed until the job definition page was saved.  Did I understand correctly?

If so, then I recommend a bug report describing the Jenkins version and plugin versions where you saw the old behavior and the Jenkins version and plugin versions where you see the current behavior.  Refer to "How to report an issue" for guidelines on issue reporting.

Mark Waite

Francois Marot

unread,
Apr 22, 2020, 10:46:03 AM4/22/20
to Jenkins Users
thanks for your response Mark.
you understood correctly. What puzzles me was that I thought that the job was not created until you save it in the configuration page, I did not think it was created as soon as you click "ok" on the page where you can choose to clone.
I thought some previous versions' behavior was not to trigger a rebuild of ALL branches of the previous job, but I just may have not realized it was the case. I maybe did not have as much branches as I have now at the time ! :D

But I think this behavior, if this is the expected one, is quite a problem and may have unintended side effect for people if some new job rebuilds another job's branches.
Reply all
Reply to author
Forward
0 new messages