2017-09-30 82 views
2

我们从单个git服务器获得450个git存储库,我们希望克隆它们一次,并在Jenkins中将它们拉到下一个目标位置以用于构建目的。Git Multiple Repositories克隆并拉入Jenkins

通过多重SCM配置Jenkins插件是手动过程,因为我们需要在其中输入每个存储库URL。
因此,是否有任何其他插件可用于将我所有的450个存储库放在一个位置(或)可用于相同的任何命令/脚本?
请提醒。

+0

Google's'Repo'非常擅长管理多个存储库。请参阅https://code.google.com/archive/p/git-repo/,您可以在其中找到如何安装和使用它。您可能还需要https://gerrit.googlesource.com/git-repo/+/master/docs/manifest-format.txt – ElpieKay

回答

2

Checkout multiple git repos into same Jenkins workspace中所述,您现在(2017)需要使用Pipeline+Plugin才能在同一作业中构建多个Git回购。

背后管道的想法是,你可以将其存储在其自己的Git回购一file (called jenkinsfile)和定义一个詹金斯作业(类型为“管道”),这将寻找Jenkinfile

使用见this exampledir基本步骤:

dir: Change current directory 

改变当前目录。
dir块内的任何步骤都将使用此目录作为当前目录,任何相对路径都将使用它作为基本路径。

同样的例子使用gradle,它知道如何build multiple projects

OP Mohan S.使用的-C option I mentioned here

下面的命令工作。

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

以下命令有效。 git -C mohan_test pull || git clone -b mohan_branch --single-branch ssh://[email protected]:29418/mohan_test mohan_test – MKumar

+0

@ Mohan.S太棒了!我已将您的评论纳入答案中,以获得更多的知名度。 (以及'-C'选项的链接) – VonC

+0

好的,谢谢VonC ....! – MKumar