I want to build a project using two Git repositories. One of them contains of the source code, while the other has the build and deployment scripts.
My problem is that I need to have a repository for building and deployment of different parts of the project (big project, multiple repositories, same build and deployment scripts), but Jenkins does not seem to be able to handle this (or I don't know/didn't find how).
I had the same question, when I looked at the Multiple SCM plugin answer I noticed this plugin is now listed as deprecated. There is a notice that recommends to use a pipeline for this.
Below is a sample config of how I managed to do this with a pipeline.
UPDATE
Multiple SCMs Plugin is now deprecated so users should migrate to Pipeline plugin.
Old answer
Yes, Jenkins can handle this. Just use
Multiple SCMs
under Source Code Management, add your repositories and then go to the Advanced section of each repository. Here you need to setLocal subdirectory for repo (optional)
andUnique SCM name (optional)
.Your repository will be pulled to the Local subdirectory which you have set so then you can build them in any order you want.
Updating per
harish
s answer - you need to install Multiple SCMs Plugin in order to achieve this functionality.Just sharing my experience when dealing with Multiple SCM. If you want to add multiple git repositories in your jenkins build, make sure that the other git plugin versions are compatible with Multiple SCM plugin. Here's a list of plugin with version which worked for me:
Earlier I upgraded to Multiple SCM 0.3 and I was not able to add any git repo in that section.
Rgds, Manu
When you add another SCM via the Multiple SCM plugin and choose Git. You can specify to 'Check out to a sub-directory' via the 'Additional Behaviours' options for a repo. Thus you can have multiple repos in a workspace.
Answer from Petr Mensik is right but this does not seem to be available by default in Jenkins. One needs to install Multiple SCM plugin to get this feature: https://wiki.jenkins-ci.org/display/JENKINS/Multiple+SCMs+Plugin