2017-02-16 50 views
0

當我嘗試使用webhooks的gitlab與Jenkins進行配置時我正面臨着gitlab的問題。當我把代碼gitlab,觀察到的錯誤在我的日誌如下從production.log當代碼被推送到gitlab時,無法觸發jenkins生成

Started GET "/root/first1.git/info/refs?service=git-receive-pack" for 10.X.x.x. at 2017-02-16 13: 
41:40 -0500 
Processing by Projects::GitHttpController#info_refs as */* 
    Parameters: {"service"=>"git-receive-pack", "namespace_id"=>"root", "project_id"=>"first1.git"} 
Filter chain halted as :authenticate_user rendered or redirected 
Completed 401 Unauthorized in 20ms (Views: 0.5ms | ActiveRecord: 2.0ms) 
Started GET "/root/first1.git/info/refs?service=git-receive-pack" for 10.X.x.x at 2017-02-16 13: 
41:41 -0500 
Processing by Projects::GitHttpController#info_refs as */* 
    Parameters: {"service"=>"git-receive-pack", "namespace_id"=>"root", "project_id"=>"first1.git"} 
Filter chain halted as :authenticate_user rendered or redirected 
Completed 401 Unauthorized in 17ms (Views: 0.4ms | ActiveRecord: 1.9ms) 
Started GET "/root/first1.git/info/refs?service=git-receive-pack" for 10.x.x.x at 2017-02-16 13: 
41:41 -0500 
Processing by Projects::GitHttpController#info_refs as */* 
    Parameters: {"service"=>"git-receive-pack", "namespace_id"=>"root", "project_id"=>"first1.git"} 
Completed 200 OK in 106ms (Views: 0.2ms | ActiveRecord: 4.3ms) 
Started POST "/root/first1.git/git-receive-pack" for 10.x.x.x at 2017-02-16 13:41:42 -0500 
Processing by Projects::GitHttpController#git_receive_pack as application/x-git-receive-pack-result 
    Parameters: {"namespace_id"=>"root", "project_id"=>"first1.git"} 
Completed 200 OK in 106ms (Views: 0.3ms | ActiveRecord: 4.2ms) 
Started POST "/api/v3/internal/allowed" for 127.x.x.x at 2017-02-16 13:41:42 -0500 
Started GET "/api/v3/internal/broadcast_message" for 127.x.x.x at 2017-02-16 13:41:42 -0500 
Started GET "/api/v3/internal/merge_request_urls?project=/var/opt/gitlab/git-data/repositories/root/ 
first1.git&changes=1de706faf4e91b9f9264e114e12bdfdf16ff6d99%208b239d8f63c5db38a8d725baa62d5930371eea 
fb%20refs/heads/master%0A" for 127.x.x.x. at 2017-02-16 13:41:42 -0500 
WebHook Error => Failed to open TCP connection to 192.X.x.x.:8080 (getaddrinfo: Name or service 
not known) 
Updating statistics for project 3 
Scheduling removal of build artifacts 
+0

次要代碼格式 - 使日誌更具可讀性。 – eugen

+0

您是否使用Jenkins管道?你如何試圖從GitLab中觸發Jenkins的構建? –

+0

您是否安裝了此插件:https://wiki.jenkins-ci.org/display/JENKINS/GitLab+Plugin – lax1089

回答

0

從閱讀你的日誌:

網絡掛接錯誤=>無法打開TCP連接192.Xxx :8080(getaddrinfo:名稱或服務未知)

似乎有點奇怪,看起來像名稱解析錯誤與IP地址發生,但通常看起來像你有某種網絡問題,可以防止您的GitLab服務器無法訪問conf配置IP地址和端口。

也許有防火牆阻止來自GitLab服務器的出站連接,或者webhook URL中的Jenkins服務器的IP地址不正確。

+0

是的,我甚至試圖從服務器gitlab和Jenkins做telnet。但最後我重新配置了服務器,然後通過給予http 200響應開始工作。因爲我們正在使用廚師來安裝它,所以我摧毀了廚房,然後廚房收斂。這幫助我解決了這個錯誤。 – pandey

0

使用Git plugin - 據我所知,它的工作原理,不太瞭解Gitlab插件抱歉。

上GitLab你的網絡掛接URL應設置爲:

http://jenkins.example.com/git/notifyCommit?url=https://gitlab.example.com/project/repository 

替換https://gitlab.example.com/project/repository與你的Git倉庫的URL。您可以通過訪問gitlab中的repo來獲取URL,只需將URL從瀏覽器URL欄中複製即可。

當您選擇的事件發生時,這應該會觸發Jenkins上的構建。

相關問題