2017-09-30 28 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