重启Slave机器后,Jenkins构建作业不会继续下游作业

时间:2016-11-02 18:22:30

标签: jenkins jenkins-plugins

我使用带有2台从机(VM)的主从配置。我有一个Build作业,只需使用“执行Windows批处理命令”重新启动从属计算机'

shutdown.exe /r /t 00

在构建后操作中,我构建了另一个项目(下游任务),该项目安装程序然后执行它。但是,我的作业在重新启动时立即失败并忽略了下游任务。它可以在一个VM上运行,而不是在另一个VM上运行,即使一台机器是从另一台机器克隆的。这让我很生气,有什么想法吗?

这是我在控制台输出中得到的错误:

Building remotely on TESTVM_1 in workspace C:\Jenkins\workspace\Execute TestApp

[Execute TestApp] $ cmd /c call C:\QATEMP~1\hudson5086584301890012619.bat

C:\Jenkins\workspace\Execute TestApp>shutdown.exe /r /t 00 

C:\Jenkins\workspace\Execute TestApp>exit 0 
FATAL: java.io.IOException: Connection aborted: org.jenkinsci.remoting.nio.NioChannelHub$MonoNioTransport@2ae04688[name=TESTVM_1]
hudson.remoting.RequestAbortedException: java.io.IOException: Connection aborted: org.jenkinsci.remoting.nio.NioChannelHub$MonoNioTransport@2ae04688[name=TESTVM_1]
    at hudson.remoting.Request.abort(Request.java:303)
    at hudson.remoting.Channel.terminate(Channel.java:863)
    at hudson.remoting.Channel$1.terminate(Channel.java:509)
    at hudson.remoting.AbstractByteArrayCommandTransport$1.terminate(AbstractByteArrayCommandTransport.java:71)
    at org.jenkinsci.remoting.nio.NioChannelHub$NioTransport.abort(NioChannelHub.java:208)
    at org.jenkinsci.remoting.nio.NioChannelHub.run(NioChannelHub.java:629)
    at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    at ......remote call to TESTVM_1(Native Method)
    at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1433)
    at hudson.remoting.Request.call(Request.java:172)
    at hudson.remoting.Channel.call(Channel.java:796)
    at hudson.Launcher$RemoteLauncher.kill(Launcher.java:953)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:540)
    at hudson.model.Run.execute(Run.java:1720)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:404)
Caused by: java.io.IOException: Connection aborted: org.jenkinsci.remoting.nio.NioChannelHub$MonoNioTransport@2ae04688[name=TESTVM_1]
    at org.jenkinsci.remoting.nio.NioChannelHub$NioTransport.abort(NioChannelHub.java:208)
    at org.jenkinsci.remoting.nio.NioChannelHub.run(NioChannelHub.java:629)
    at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: An existing connection was forcibly closed by the remote host
    at sun.nio.ch.SocketDispatcher.read0(Native Method)
    at sun.nio.ch.SocketDispatcher.read(Unknown Source)
    at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source)
    at sun.nio.ch.IOUtil.read(Unknown Source)
    at sun.nio.ch.SocketChannelImpl.read(Unknown Source)
    at org.jenkinsci.remoting.nio.FifoBuffer$Pointer.receive(FifoBuffer.java:137)
    at org.jenkinsci.remoting.nio.FifoBuffer.receive(FifoBuffer.java:310)
    at org.jenkinsci.remoting.nio.NioChannelHub.run(NioChannelHub.java:561)
    ... 6 more
Warning: you have no plugins providing access control for builds, so falling back to legacy behavior of permitting any downstream builds to be triggered
Finished: FAILURE

提前致谢!

1 个答案:

答案 0 :(得分:0)

您正在使用的命令会立即重新启动。这意味着在重新启动计算机时,归档结果等构建后的步骤仍在运行。而不是/ t 00,使用/ t 30,然后采取措施确保在30秒内没有新作业开始运行。您可能还希望在shutdown命令之后添加exit 0,以确保当前批处理命令干净地存在。您在构建后任务中的安装也应该进入另一个工作。