[JIRA] (JENKINS-47874) Support multiple repositories in multi-branch pipeline

0 views
Skip to first unread message

rok.povse@sunesis.si (JIRA)

unread,
Mar 20, 2018, 11:08:02 AM3/20/18
to jenkinsc...@googlegroups.com
Rok Povse updated an issue
 
Jenkins / Bug JENKINS-47874
Support multiple repositories in multi-branch pipeline
Change By: Rok Povse
Sprint: Blue Ocean 1.5 - beta 3
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

rok.povse@sunesis.si (JIRA)

unread,
Mar 20, 2018, 11:13:02 AM3/20/18
to jenkinsc...@googlegroups.com
Rok Povse assigned an issue to Andrew Bayer
 

We would really need this issue to be fixed. Could you please provide us with a solution?

Change By: Rok Povse
Assignee: Andrew Bayer

nagudivyas@gmail.com (JIRA)

unread,
Jul 12, 2018, 3:28:01 AM7/12/18
to jenkinsc...@googlegroups.com
Rajalakshmi Nagendran updated an issue
Change By: Rajalakshmi Nagendran
Within a single job, we need to source branches from multiple repositories that we do not have control over. Currently, if the same branch name occurs in different repositories, only the first is built and subsequent identical branches are dropped.

 

I suggest that the remote name (if configured) be used to disambiguate the branches, so that they can all be built.

eg.
Remote name: linux
Branch: master

Remote Name: linux-next
Branch:
master master11

These would be resolved as linux/master and linux-next/master.

 
This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)

andrew.bayer@gmail.com (JIRA)

unread,
Nov 15, 2018, 12:25:04 PM11/15/18
to jenkinsc...@googlegroups.com
Andrew Bayer updated an issue
 
Jenkins / New Feature JENKINS-47874
Change By: Andrew Bayer
Issue Type: Bug New Feature
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

jonkelley@gmail.com (JIRA)

unread,
Jun 26, 2019, 6:47:02 PM6/26/19
to jenkinsc...@googlegroups.com
Jon Kelley commented on New Feature JENKINS-47874
 
Re: Support multiple repositories in multi-branch pipeline

Mark Waite

Here is a use-case for you. See the multi-lined comment areas below. Is there any ideas to achieve something similar??

We need to run an external pipeline script which lives in a scripts repository, because we don't want to put our shared pipeline scripts in 900+ chef module repositories or use submodules.

We've hit a brick wall for our use case since updating Job DSL 1.70 to 1.74 since pipelineJob is dead for supporting SCM.

multibranchPipelineJob is lacking multi git functionality.

// Generate PR push pipeline jobs for all of the repos passed in via REPO_LISTdef repoList = "${REPO_LIST}".trim().replaceAll('"', '').split(",")

println "Generating PR push jobs for the following repos:: $repoList"
repoList.each {
    def cookbook = it
    multibranchPipelineJob("chef-${cookbook}-PR-push") {
        description("Chef push pipeline job")
        branchSources {
            github {
                buildOriginPRHead() // Build fork PRs (unmerged head).
                // buildOriginPRMerge() // Build fork PRs (merged with base branch).
                buildOriginBranchWithPR() // Build origin branches also filed as PRs.
                checkoutCredentialsId('fffff-fffff-fffff-fffff')
                // scanCredentialsId('github-ci')
                repoOwner('myOwner')
                repository("${cookbook}")
            }
        }
        configure {
            // my Jenkinsfile doesn't exist in the chef coookbooks for 900 repositories...
            // how can we set a seperate git repo for shared scripts?
            // https://stackoverflow.com/questions/48284589/jenkins-jobdsl-multibranchpipelinejob-change-script-path
            it / factory(class: 'org.jenkinsci.plugins.workflow.multibranch.WorkflowBranchProjectFactory') {
                owner(class: 'org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject', reference: '../..')
                scriptPath("jenkins/[where ever you want]/Jenkinsfile")
            }
        }
    }
 }

 

pipelineJob worked excellent for our needs, the old broken syntax is below:

repoList.each {
  def cookbook = it
  pipelineJob("chef-${cookbook}-PR-push") {
    definition {
      cpsScm {
        lightweight(true)
        scriptPath('jenkins/[where ever you want]/Jenkinsfile')
        scm {
          git {
            branch('master')
            remote {
              github("organization/scripts", 'ssh')
              credentials('ffff-fff-fff-ffffff)
            }
          }
        }
      }
    }
  }
}
 

andreilhicas@gmail.com (JIRA)

unread,
Aug 2, 2019, 12:27:03 PM8/2/19
to jenkinsc...@googlegroups.com

There is actually a TODO for exactly the same use case in the responsible getName function for branch name

https://github.com/jenkinsci/branch-api-plugin/blob/1039350970768b27c88bebb0dad6ff9c96e50e0e/src/main/java/jenkins/branch/Branch.java#L143

What would be the impacts of adding another constructor to allow the remote name to be passed as a prefix for instance?

andreilhicas@gmail.com (JIRA)

unread,
Aug 2, 2019, 12:27:06 PM8/2/19
to jenkinsc...@googlegroups.com
There is actually a TODO for exactly the same use case described in this issue in the responsible getName function for branch name in Branch class at branch-api-plugin

[https://github.com/jenkinsci/branch-api-plugin/blob/1039350970768b27c88bebb0dad6ff9c96e50e0e/src/main/java/jenkins/branch/Branch.java#L143]


What would be the impacts of adding another constructor to allow the remote name to be passed as a prefix for instance?
Reply all
Reply to author
Forward
0 new messages