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

Branch indexing always attempts to create a new project for conflicting branch names from multiple sources

    Details

    • Similar Issues:

      Description

      cc Jesse Glick

      If you have multiple SCMSource s on a multibranch project, for example two Git repos that both have a "master" branch (or any branch name for that matter), and one source does not exclude the conflict, then the MultiBranchProject attempts to create the branch again for each source.

      Because the project for that branch already exists and has built, you end up with a bunch of dead executors because builds for these new projects get triggered.

      Started
      Setting origin to /foo/bar/project1.git
      Fetching origin...
      Pruning stale remotes...
      Getting remote branches...
      Checking branch stable
      Checking branch feat/tracking-data
      Checking branch master
      Scheduling build for branch: master
      Checking branch development
      Scheduling build for branch: development
      Checking branch feat/test
      Done.
      Setting origin to /foo/bar/project2.git
      Fetching origin...
      Pruning stale remotes...
      Getting remote branches...
      Checking branch master
      Scheduling build for branch: master
      Checking branch development
      Scheduling build for branch: development
      Done.
      Finished: SUCCESS
      
      Thread has died
      
      java.lang.IllegalStateException: /Users/mjdetullio/jenkins/jobs/freestyle-multi/branches/master/builds/1 already existed; will not overwrite with freestyle-multi/master #1
      	at hudson.model.RunMap.put(RunMap.java:188)
      	at jenkins.model.lazy.LazyBuildMixIn.newBuild(LazyBuildMixIn.java:176)
      	at hudson.model.AbstractProject.newBuild(AbstractProject.java:1019)
      	at hudson.model.AbstractProject.createExecutable(AbstractProject.java:1210)
      	at hudson.model.AbstractProject.createExecutable(AbstractProject.java:145)
      	at hudson.model.Executor$1.call(Executor.java:364)
      	at hudson.model.Executor$1.call(Executor.java:346)
      	at hudson.model.Queue._withLock(Queue.java:1405)
      	at hudson.model.Queue.withLock(Queue.java:1270)
      	at hudson.model.Executor.run(Executor.java:346)
      

      The obvious solution is to make sure your includes/excludes are properly defined. However, if users do not have a clearly defined naming convention and wish to pull from multiple SCMSource s, then there is nothing to prevent them from entering an erroneous state where multiple projects for a branch exist in memory trying to share the same config location on the filesystem. This in itself is a problem that is easily encountered, even if the use case of having two jobs for a branch with the same name is not supported.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                mjdetullio Matthew DeTullio
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: