【发布时间】:2017-10-06 19:53:59
【问题描述】:
詹金斯 2.82
Jenkins master - 在这台机器上,我无法访问互联网/外部世界。
Jenkins 从属服务器,运行 docker 容器(用于从属服务器),可以访问外部世界/互联网。
我安装了 PagerDuty 插件并在作业中正确配置了它,以便在每次失败以及状态恢复正常时发送通知。
当我运行作业时,我收到以下错误消息 com.mashape.unirest.http.exceptions.UnirestException: org.apache.http.conn.ConnectTimeoutException: Connect to events.pagerduty.com:443 [events.pagerduty.com/54.244.255.45, events.pagerduty.com/54.241.36.66, events.pagerduty.com/104.45.235.10] failed: connect timed out。
0:49:44
10:49:44 Resolving incident
10:50:14 Error while trying to resolve
10:50:14 com.mashape.unirest.http.exceptions.UnirestException: org.apache.http.conn.ConnectTimeoutException: Connect to events.pagerduty.com:443 [events.pagerduty.com/54.244.255.45, events.pagerduty.com/54.241.36.66, events.pagerduty.com/104.45.235.10] failed: connect timed out
10:50:14 Build step 'PagerDuty Incident Trigger' marked build as failure
10:50:14 Notifying upstream projects of job completion
10:50:14 Finished: FAILURE
我首先登录从机并尝试 ping events.pagerduty.com 服务器旁边的 IP(如上所列)并且 ping 工作正常。在端口 443 (ssh) 上执行 telnet 也提供了有效的输出。
由于从属服务器实际上是 docker 容器,我进入其中一个容器从属服务器并做了同样的事情(ping, telnet on 443 for those events.pagerduty.com IPs、nslookup 和 nc / ncat 等,输出看起来不错)。
在这里,我在 docker slave 容器的主机内,即我运行 docker exec -it shenazi_ninza bash,现在我在容器的主机/IP 内:
root@da5ca3fef1c8:/data# hostname
da5ca3fef1c8
root@da5ca3fef1c8:/data# hostname; hostname -i
da5ca3fef1c8
172.17.137.77
root@da5ca3fef1c8:/data# nslookup events.pagerduty.com
Server: 17.178.6.10
Address: 17.178.6.10#53
Non-authoritative answer:
events.pagerduty.com canonical name = events.gslb.pagerduty.com.
Name: events.gslb.pagerduty.com
Address: 54.241.36.66
Name: events.gslb.pagerduty.com
Address: 54.245.112.46
Name: events.gslb.pagerduty.com
Address: 104.45.235.10
root@da5ca3fef1c8:/data#
root@da5ca3fef1c8:/data# for s in `nslookup events.pagerduty.com|grep "Address: [0-9]"|sed "s/ //g"|cut -d':' -f2`; do echo Server: $s; telnet $s 443; done
Server: 54.245.112.46
Trying 54.245.112.46...
Connected to 54.245.112.46.
Escape character is '^]'.
^]
telnet> quit
Connection closed.
Server: 104.45.235.10
Trying 104.45.235.10...
Connected to 104.45.235.10.
Escape character is '^]'.
^]
telnet> quit
Connection closed.
Server: 54.241.36.66
Trying 54.241.36.66...
Connected to 54.241.36.66.
Escape character is '^]'.
^]
telnet> quit
Connection closed.
root@da5ca3fef1c8:/data# for s in `nslookup events.pagerduty.com|grep "Address: [0-9]"|sed "s/ //g"|cut -d':' -f2`; do echo Server: $s; telnet $s 443; done
Server: 54.245.112.46
Trying 54.245.112.46...
Connected to 54.245.112.46.
Escape character is '^]'.
^]
telnet> quit
Connection closed.
Server: 54.241.36.66
Trying 54.241.36.66...
Connected to 54.241.36.66.
Escape character is '^]'.
^]
telnet> quit
Connection closed.
Server: 54.244.255.45
Trying 54.244.255.45...
Connected to 54.244.255.45.
Escape character is '^]'.
^]
telnet> quit
Connection closed.
root@da5ca3fef1c8:/data# ^C
root@da5ca3fef1c8:/data# nc -v -w 1 events.pagerduty.com 443
Connection to events.pagerduty.com 443 port [tcp/https] succeeded!
root@da5ca3fef1c8:/data#
在 POST Built Actions 区域下可以使用 Jenkins 作业配置中的 PagerDuty 集成。
我的问题是,整个工作不是在从属服务器上运行吗?
似乎 Jenkins 在我无法访问 events.pagerduty.com(ping/telnet 等)的主 Jenkins 实例上的 POST Build Data 部分下运行任何东西?由于我们不希望 Jenkins master 拥有外部世界访问权限,如何解决此问题,以便在该作业的构建失败时收到警报?
【问题讨论】:
标签: jenkins connection-timeout post-build-event jenkins-2 pagerduty