3

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
user4948798
  • 1,924
  • 4
  • 43
  • 89
  • Google's `Repo` is very good at managing multiple repositories. Please see https://code.google.com/archive/p/git-repo/ where you can find how to install and use it. You may also need https://gerrit.googlesource.com/git-repo/+/master/docs/manifest-format.txt – ElpieKay Sep 30 '17 at 02:26

1 Answers1

3

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://mohan.s@100.101.102.103:29418/mohan_test mohan_test –
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • The following command worked. git -C mohan_test pull || git clone -b mohan_branch --single-branch ssh://mohan.s@100.101.102.103:29418/mohan_test mohan_test – user4948798 Oct 04 '17 at 05:32
  • @Mohan.S Great! I have included your comment in the answer for more visibility. (As well as a link to the `-C` option) – VonC Oct 04 '17 at 05:57