詹金斯 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 容器,我进入其中一个容器从属服务器并做了同样的事情(对于这些 events.pagerduty.com IP、nslookup 和 nc / ncat 等,在 443 上进行 ping、telnet 和输出看起来不错)。
在这里,我在 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#
Jenkins 作业配置中的 PagerDuty 集成在POST Built Actions
area 下可用。
我的问题是,整个工作不是在从服务器上运行吗(又名容器的从服务器,我可以从那里访问外部世界并且我能够连接到 events.pagerduty.com 服务器)?
似乎 JenkinsPOST Build Data
在我无法访问 events.pagerduty.com(ping/telnet 等)的主 Jenkins 实例上运行该部分下的任何内容?由于我们不希望 Jenkins master 具有外部世界访问权限,如何解决此问题,以便在该作业的构建失败时收到警报?