Multiple Github repositories in a build

7 views
Skip to first unread message

lance...@gmail.com

unread,
Oct 1, 2018, 7:49:15 PM10/1/18
to Jenkins Users
I have some builds that require multiple github repos.  One contains build scripts on master branch.   ANother contains code on a different branch.

I noticed the source code management settings in Jenkins there is a way to add another repository but it only allows me to specify one branch.  

How can I add another repository to my build project?  



thanks in advance.

Mark Waite

unread,
Oct 1, 2018, 8:24:14 PM10/1/18
to jenkins...@googlegroups.com
If you're using a Jenkins Pipeline, you can checkout multiple repositories so long as each repository is placed into its own directory in the workspace.  You define the checkout, including the repository URL, the credentials, and the branch.

If you're not using a Jenkins Pipeline, you should not use multiple repositories.  Yes, there are techniques like the multiple SCM plugin that will allow some multiple repository scenarios, but none of them work as well as Pipeline.

Refer to https://github.com/MarkEWaite/jenkins-bugs/blob/526b36de2203f65ada40b9a606c7cba1cddcfa98/Jenkinsfile#L37 for one example.  In that example, a checkout of a non-master branch is followed by a ws() { } block which then performs a checkout of the master branch inside the new workspace created by the 'ws() { } block.

Mark Waite

--
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/7da67a84-b965-4a03-b6f0-a85f4d66543e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages