2017-08-29 59 views
0

我試圖自動化Jenkins(atm.2.6.3,團隊基礎服務器插件 5.121.0,git插件3.5.1,git客戶端插件2.5.0)與TFS(15.117.26714.0)Jenkins找不到TFS Git Repository中的Pull請求參數來構建合併

「啓用所有作業的所有作業/團隊狀態的推動觸發器」存在於Jenkins配置中,使用測試時,soap api連接確實有效連接按鈕。

我有一個Multibranch管道項目在該TFS服務器上配置了一個git存儲庫;我的主要問題是,掃描refspecs時找不到拉請求;我多枝管道項目的refspecs是:

參考規格

+refs/heads/*:refs/remotes/@{remote}/* 

和參考規格

+refs/pull/*:refs/remotes/@{remote}/pull/* 

我們從TFS 2015年的地方,如果我正確地記得,refspecs是

更新
+refs/pull/*:refs/remotes/@{remote}/pr/* 

和舊的2015年TFS有可能找到pr/refs並獲得multib牧場的工作等

<JENKINSHOST>:8080/job/MultibranchJob/job/pr%252f<PRID> 
  • 雖然這是幾個月前,我也已經更新了詹金斯的LTS版本和所有插件。

這反過來會開始驗證應該完成的拉取請求是否不破壞構建。 (據我所知,在TFS插件中沒有像在bitbucket和github插件中那樣實現pull請求)

@ {remote}/pr/*和@ {remote}/pull/*似乎都找不到該refspecs。 詹金斯主機擁有自己的編譯Git版本2.13.3,因爲CentOS的7混帳太老了,與2017年TFS

正常通信,但拉入請求裁判規範是無處可尋:

Started by user Jenkins admin 
[Tue Aug 29 12:49:03 CEST 2017] Starting branch indexing... 
> git rev-parse --is-inside-work-tree # timeout=10 
Setting origin to MYOWNTFSGITREPO 
> git config remote.origin.url MYOWNTFSGITREPO # timeout=10 
Fetching origin... 
Fetching upstream changes from origin 
> git --version # timeout=10 
using GIT_ASKPASS to set credentials 
> git fetch --tags --progress origin +refs/pull/*:refs/remotes/origin/pull/* +refs/heads/*:refs/remotes/origin/* 
using GIT_ASKPASS to set credentials 
> git ls-remote --symref MYOWNTFSGITREPO # timeout=10 
using GIT_ASKPASS to set credentials 
> git ls-remote MYOWNTFSGITREPO # timeout=10 
> git rev-parse --is-inside-work-tree # timeout=10 
Setting origin to MYOWNTFSGITREPO 
> git config remote.origin.url MYOWNTFSGITREPO # timeout=10 
Fetching & pruning origin... 
Fetching upstream changes from origin 
> git --version # timeout=10 
using GIT_ASKPASS to set credentials 
> git fetch --tags --progress origin +refs/pull/*:refs/remotes/origin/pull/* +refs/heads/*:refs/remotes/origin/* --prune 
Listing remote references... 
> git config --get remote.origin.url # timeout=10 
using GIT_ASKPASS to set credentials 
> git ls-remote -h MYOWNTFSGITREPO # timeout=10 
Checking branches... 
    Checking branch develop 
     ‘Jenkinsfile’ found 
    Met criteria 
Changes detected: develop (51e43e3456f49506086ad5649282695d9f0eff7d → 6008de4da7d017b35cb73cf28963057b8512584c) 
Did not schedule build for branch: develop 
    Checking branch master 
     ‘Jenkinsfile’ found 
    Met criteria 
Changes detected: master (5c2f4df13a6cf53700ff1562d5347c31ff2a8d69 → b856b96743870bc80d9523c79922b01bfe0f363b) 
Did not schedule build for branch: master 
    Checking branch feature/myFeature 
     ‘Jenkinsfile’ found 
    Met criteria 
No changes detected: feature/myFeature (still at 72fa143c6cbf4cf492129ad43f9a0053d5edf785) 
Processed 3 branches 
[Tue Aug 29 12:49:03 CEST 2017] Finished branch indexing. Indexing took 0.57 sec 
Finished: SUCCESS 

但如果我使用git LS-遠離我的dev-PC:

$ git ls-remote 
From MYOWNTFSGITREPO 
b856b96743870bc80d9523c79922b01bfe0f363b  HEAD 
6008de4da7d017b35cb73cf28963057b8512584c  refs/heads/develop 
72fa143c6cbf4cf492129ad43f9a0053d5edf785  refs/heads/feature/myFeature 
b856b96743870bc80d9523c79922b01bfe0f363b  refs/heads/master 
d6998b37fb29dc5eb6eaac812b8af58e8f31d402  refs/pull/26/merge 

是有可能的是,--prune刪除合併,因爲這很可能是不可到達的?但是,合併應該有兩個分支中的父母用於拉取請求,對嗎?

我錯過了一些痛苦明顯的東西嗎?

掃描回購作品,否則所有其他分支無法找到。

我知道爲拉取請求做自己的分支有點冒險,儘管它確實可以驗證合併後的代碼是否有效。如果有更好的方法來實施多分支項目的測試,我絕對可以採用不同的方法。

編輯:

試圖在我的dev-PC從上面的日誌中的所有命令;最後的

git ls-remote -h MYOWNTFSREPO 

限制只有頭,有沒有可能規避這種情況? git ls-remote MYOWNTFSREPO也會給我/ refs/pull //合併,這正是我想要開始建立Pr合併提交。

+0

縮小問題的範圍與遠程git存儲庫在TFS2017服務器上是否相關。建議您也試試其他遠程回購在GitHub或bitbuck上持有。 –

+0

對不起,我希望我的編輯更清楚地說明了這一點:由於最後一個git ls-remote與-h一起使用,它只能得到/ refs/heads而不是/ refs/tags(我不想在這裏現在反正)也沒有/ refs /拉,其中我/ refs /拉/ /合併裁判將居住; 這使我相信它可能有更多的關於git插件或multibranch管道插件;仍然,如果在我必須合併之前有更好的方式來驗證TFS2017的拉取請求的正確構建,我爲任何想法感到高興。編輯的問題反映了這一點。 –

回答

0

Multibranch Pieline項目中的拉取請求現在僅支持「GitHub」和「Bitbucket」分支源。使用Git插件無法實現,因爲插件只能發現分支,而Github源分支插件支持「發現來自原點的請求」。

支持引入請求

隨着「GitHub上」或「到位桶」科源,多枝管道可用於驗證拉/變化 請求。該功能分別由GitHub Branch Source和Bitbucket Branch Source插件提供。有關如何使用這些 插件的更多信息,請參閱 其文檔。

有關詳細信息,請參閱此鏈接:Branches and Pull Requests