詹金斯:由于工作区问题,从红色到灰色,我该如何为失败的构建颜色? [英] Jenkins: how do I make the color of a failed build due to a workspace issue from red to gray?

查看:807
本文介绍了詹金斯:由于工作区问题,从红色到灰色,我该如何为失败的构建颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

仅当在构建代码时出现问题(例如编译问题)时,才应该对我们的詹金斯版本进行红色.

Our jenkins build should only be red when there's a problem when building our code such as a compilation problem.

如果存在sysops问题-例如工作空间已满,一些奴隶掉了下来,...我们需要把工作变成灰色,以表明Jenkins本身存在一个问题,但应该将开发人员置于高度戒备状态.

If there's a sysops issue - such as the workspace being full, some slaves are down, ... we need the job to become gray, to indicate there's a problem with Jenkins itself, but that the developers should not be put on high alert.

这是一个作业日志,需要将其变成灰色而不是红色:

Here's a job log that needs to turn the job gray instead of red:

04:19:19 ERROR: SEVERE ERROR occurs
04:19:19 org.jenkinsci.lib.envinject.EnvInjectException: hudson.remoting.ChannelClosedException: channel is already closed
04:19:19    at org.jenkinsci.plugins.envinject.service.EnvironmentVariablesNodeLoader.gatherEnvironmentVariablesNode(EnvironmentVariablesNodeLoader.java:75)
04:19:19    at org.jenkinsci.plugins.envinject.EnvInjectListener.loadEnvironmentVariablesNode(EnvInjectListener.java:81)
04:19:19    at org.jenkinsci.plugins.envinject.EnvInjectListener.setUpEnvironment(EnvInjectListener.java:39)
04:19:19    at hudson.model.AbstractBuild$AbstractBuildExecution.createLauncher(AbstractBuild.java:572)
04:19:19    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:492)
04:19:19    at hudson.model.Run.execute(Run.java:1738)
04:19:19    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531)
04:19:19    at hudson.model.ResourceController.execute(ResourceController.java:98)
04:19:19    at hudson.model.Executor.run(Executor.java:410)
04:19:19 Caused by: hudson.remoting.ChannelClosedException: channel is already closed
04:19:19    at hudson.remoting.Channel.send(Channel.java:578)
04:19:19    at hudson.remoting.Request.call(Request.java:130)
04:19:19    at hudson.remoting.Channel.call(Channel.java:780)
04:19:19    at hudson.FilePath.act(FilePath.java:1074)
04:19:19    at org.jenkinsci.plugins.envinject.service.EnvironmentVariablesNodeLoader.gatherEnvironmentVariablesNode(EnvironmentVariablesNodeLoader.java:44)
04:19:19    ... 8 more
04:19:19 Caused by: java.io.IOException
04:19:19    at hudson.remoting.Channel.close(Channel.java:1163)
04:19:19    at hudson.slaves.ChannelPinger$1.onDead(ChannelPinger.java:118)
04:19:19    at hudson.remoting.PingThread.ping(PingThread.java:126)
04:19:19    at hudson.remoting.PingThread.run(PingThread.java:85)
04:19:19 Caused by: java.util.concurrent.TimeoutException: Ping started at 1456305240982 hasn't completed by 1456305480982
04:19:19    ... 2 more
04:19:19 ERROR: Step ‘Archive the artifacts’ failed: no workspace for optaplanner #770

推荐答案

以下是使用有条件的BuildStep插件

这是控制台输出:

Started by user anonymous
[EnvInject] - Loading node environment variables.
Building on master in workspace /var/lib/jenkins/jobs/test make the build abort/workspace
Run condition [Regular expression match] enabling prebuild for step [BuilderChain]
[workspace] $ /bin/sh -xe /tmp/hudson4695476115086720006.sh
+ echo '04:19:19 Caused by: hudson.remoting.ChannelClosedException: channel is already closed'
04:19:19 Caused by: hudson.remoting.ChannelClosedException: channel is already closed
Regular expression run condition: Expression=[(?is).*channel is already closed.*], Label=[[...truncated 5 lines...]
+ echo '04:19:19 Caused by: hudson.remoting.ChannelClosedException: channel is already closed'
04:19:19 Caused by: hudson.remoting.ChannelClosedException: channel is already closed
]
Run condition [Regular expression match] enabling perform for step [BuilderChain]
Setting result to [Aborted]
Build step 'Conditional steps (multiple)' changed build result to ABORTED
Build step 'Conditional steps (multiple)' marked build as failure
[BFA] Scanning build for known causes...
[BFA] No failure causes found
[BFA] Done. 0s
Notifying upstream projects of job completion
Finished: ABORTED

它可以解决您的问题吗? :)

Does it solve your problem? :)

这篇关于詹金斯:由于工作区问题,从红色到灰色,我该如何为失败的构建颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆