将更改推送到GitHub时启动从属Jenkins节点

时间:2016-05-30 08:07:33

标签: github jenkins

当我将更改推送到GitHub时,我试图在Jenkins上构建一个项目。 我正在使用GitHub plugin并构建一个从属节点。

如果奴隶在线,一切正常。但是,如果从属设备脱机,Jenkins不会尝试启动从属节点并忽略来自GitHub的通知。

当奴隶在线时,以下日志输出到jenkins.log

May 30, 2016 4:16:31 PM org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber onEvent
INFO: Received POST for https://github.com/myname/myproject
May 30, 2016 4:16:31 PM org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber$1 run
INFO: Poked MyProject
May 30, 2016 4:16:33 PM com.cloudbees.jenkins.GitHubPushTrigger$1 run
INFO: SCM changes detected in MyProject. Triggering #22

但是,如果从属设备处于脱机状态,则不会触发构建:

May 30, 2016 4:15:58 PM org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber onEvent
INFO: Received POST for https://github.com/myname/myproject
May 30, 2016 4:15:58 PM org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber$1 run
INFO: Poked MyProject

点击"立即构建&#34>开始构建始终使从属节点在线。如何通过GitHub更改可能处于脱机状态的从属节点来构建项目?

更新

我在" GitHub Hook Log"上找到了以下消息:该项目:

Started on May 30, 2016 6:00:46 PM
We need to schedule a new build to get a workspace, but deferring 561ms in the hope that one will become available soon (all_suitable_nodes_are_offline)
Done. Took 0.23 sec
No changes

更新(2016年6月1日):

这是当前的从属设置:

enter image description here

/var/lib/jenkins/bin/start-slave的内容:

#!/bin/bash -eux

gcloud compute instances start ci-slave --zone us-central1-f
ssh ci-slave /var/lib/jenkins/bin/start

0 个答案:

没有答案