Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-65900

Cloning multibranch pipeline job scans before changes can be made

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • jenkins 2.277.3
      workflow-multibranch 2.22

      When a multibranch pipeline job is cloned it gets scanned immediately - even before the job configuration is saved. As a result builds may be kicked off that would of otherwise been ignored after the user had a chance to modify the git branch configuration such as changing the branch include filter.

      Expected Behavior
      New job is not scanned until after the configuration is applied/saved.

      Actual Behavior
      A scan is started and new builds are launched before the user has a chance to modify the job configuration.

      Steps to Reproduce

      1. Create a multibranch pipeline job with some branches. Run a scan and let builds complete.
      2. Clone the job that was created above. Do not click save.
      3. In another tab look at the build queue and agent build executor status. Observe builds are being immediately launched.

          [JENKINS-65900] Cloning multibranch pipeline job scans before changes can be made

          Martin added a comment -

          This bug is probably causing issues with our company's jenkins server. 
          When cloning Multibranch pipeline job, the build runs immediatelly with configuration from original project.
          For our projects this requires manual deletion of unwanted artifacts that were created during the build. 

          Our current jenkins version is 2.289.3 and this happens in a few recent versions.  It didn't happen a few months ago, but can't tell in which version introduced this bug.

          Martin added a comment - This bug is probably causing issues with our company's jenkins server.  When cloning Multibranch pipeline job, the build runs immediatelly with configuration from original project. For our projects this requires manual deletion of unwanted artifacts that were created during the build.  Our current jenkins version is 2.289.3 and this happens in a few recent versions.  It didn't happen a few months ago, but can't tell in which version introduced this bug.

          Kalle Niemitalo added a comment - Here is code that tries to prevent the job from being built until it the user saves it: https://github.com/jenkinsci/jenkins/blob/jenkins-2.289.3/core/src/main/java/hudson/model/Job.java#L244-L269 https://github.com/jenkinsci/jenkins/blob/jenkins-2.289.3/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java#L515-L517 Perhaps this is a duplicate of JENKINS-21400 .

          C H added a comment - - edited

          Got this problem too; I've created a new Jenkinsfile named 'Jenkinsfile20.04' (new-to-us Ubuntu version), and I'm creating a new pipeline for it by cloning the old and telling it to look for the new filename.

          It's quite surprising when you finish saving the new pipeline configuration and all the build executors are full and there's 200+ entries in the build queue.

          Next time, I'm going to shrink the number of build executors to zero, create and save the new pipeline, purge the build queue, go save the pipeline configuration again, check the "scan multibranch pipeline" log to make sure it's looking for Jenkinsfile20.04, then restore the number of build executors.

          It looks like the holdoffUntilUserSaves isn't doing its job. :-/  Maybe use 'disabled' until it's fixed?

          Bug present in versions Jenkins 2.263.1 and Jenkins 2.346.1

          C H added a comment - - edited Got this problem too; I've created a new Jenkinsfile named 'Jenkinsfile20.04' (new-to-us Ubuntu version), and I'm creating a new pipeline for it by cloning the old and telling it to look for the new filename. It's quite surprising when you finish saving the new pipeline configuration and all the build executors are full and there's 200+ entries in the build queue. Next time, I'm going to shrink the number of build executors to zero, create and save the new pipeline, purge the build queue, go save the pipeline configuration again, check the "scan multibranch pipeline" log to make sure it's looking for Jenkinsfile20.04, then restore the number of build executors. It looks like the holdoffUntilUserSaves isn't doing its job. :-/  Maybe use 'disabled' until it's fixed? Bug present in versions Jenkins 2.263.1 and Jenkins 2.346.1

            Unassigned Unassigned
            mrichar2 Mark R
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: