user4948798
user4948798

Reputation: 2102

Git Multiple Repositories clone and pull in Jenkins

We have 450 git repositories from single git server and we would like to clone them once and pull them (next time onward) in Jenkins for build purpose.

Configuring through Multiple-SCM Jenkins plugin is manual process, as each repository URL we need to input in that.
Therefore is there any other plugin available to put all my 450 repositories in one place (Or) any Command/script available for the same?
Kindly advise.

Upvotes: 3

Views: 7582

Answers (1)

VonC
VonC

Reputation: 1324657

As mentioned in Checkout multiple git repos into same Jenkins workspace, you nowodays (2017) needs to use Pipeline+Plugin in order to build multiple Git repo in the same job.

The idea behind pipeline is that you can store it as a file (called jenkinsfile) in its own Git repo and define one Jenkins job (type "pipeline"), which will look for that Jenkinfile

See this example using the dir basic step:

dir: Change current directory

Change current directory.
Any step inside the dir block will use this directory as current and any relative path will use it as base path.

That same example uses gradle which knows how to build multiple projects.

The OP Mohan S. used the -C option I mentioned here:

The following command worked.

git -C mohan_test pull || git clone -b mohan_branch --single-branch ssh://[email protected]:29418/mohan_test mohan_test –

Upvotes: 3

Related Questions