2016-02-24 5 views
6

Nasza konstrukcja jenkins powinna być tylko czerwona, gdy wystąpi problem z podczas budowania naszego kodu, np. Problem z kompilacją.Jenkins: w jaki sposób zmienić kolor nieudanej kompilacji z powodu problemu z obszaru roboczego z czerwonego na szary?

Jeśli istnieje problem sysops - takich jak obszar roboczy jest pełna, niektórzy niewolnicy są w dół, ... musimy zadanie stać szary, aby wskazać istnieje problem z Jenkins samego, ale deweloperów powinien nie być postawiony na wysokie ostrzeżenie.

Oto log praca, która wymaga, aby włączyć szare pracy zamiast czerwono:

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 

Odpowiedz

3

Oto rozwiązanie przy użyciu Conditional BuildStep Plugin a Fail The Build Plugin:

enter image description here

I tu jest wyjście konsoli:

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 

Czy to rozwiązuje twój problem? :)

+1

Częściowo rozwiązany: Naprawdę uważam, że ta lista wyrażeń regularnych wspólnych "fałszywych" błędów (takich jak limit czasu połączenia git, limit czasu pobierania zależności maven, węzeł Jenniona w dół, ...) powinien być wstępnie skonfigurowany. –

Powiązane problemy