繁体   English   中英

将代码推送到gitlab时无法触发jenkins构建

[英]unable to trigger jenkins build when code is pushed to gitlab

当我尝试使用gitlab的webhooks与Jenkins进行配置项时,我遇到了gitlab的问题。 当我将代码推送到gitlab时,从production.log中观察到我的日志中的错误如下

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

通过阅读日志:

WebHook错误=>无法打开与192.Xxx:8080的TCP连接(getaddrinfo:名称或服务未知)

IP地址出现名称解析错误看起来有点奇怪,但通常看起来您遇到某种网络问题,导致您的GitLab服务器无法访问配置的IP地址和端口。

也许有防火墙阻止来自GitLab服务器的出站连接,或者Webhook URL中Jenkins服务器的IP地址不正确。

使用Git插件 -据我所知,它可以正常运行,对Gitlab插件不太确定。

您在GitLab上的webhook URL应该设置为:

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

https://gitlab.example.com/project/repository替换为git存储库的URL。 您可以通过在gitlab中访问您的存储库,然后将URL复制到浏览器URL栏中来获得URL。

当您选择的事件发生时,这应该在Jenkins上触发构建。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM