Jenkins continues to pipeline on a failed scene

I have a jenkins installation with a bunch of pipelines. I wrote a new pipeline that can immediately start all conveyors. I would like to build other stages, even if one of them does not work.

Currently the script looks like

stage 'CentOS6' build 'centos6.testing' stage 'CentOS7' build 'centos7.testing' stage 'Debian7' build 'debian7-x64.testing' stage 'Debian8' build 'debian8-x64.testing' 

Assembly scripts themselves contain the node that they must run.

How can the script continue the following steps, even if one of them does not work.

Greetings

+3
source share
3 answers

If you use the parallel step, this should work as you expect, by default, like the failFast option, which aborts the job, if any of the parallel branches fails, the default is false .

For instance:

 parallel( centos6: { build 'centos6.testing' }, centos7: { build 'centos7.testing' }, debian7: { build 'debian7-x64.testing' }, debian8: { build 'debian8-x64.testing' } ) 
+2
source

If they need to be run in sequence, you can do something like this:

 def buildResult= 'success' try{ build 'centos6.testing' }catch(e){ buildResult = 'failure' } currentBuild.result = buildResult 

If they need to be run in parallel, you just run them: https://www.cloudbees.com/blog/parallelism-and-distributed-builds-jenkins

+4
source

What worked for me:

  'Task' : { build( job : "DemoJob-2", wait: false ) build( job : "DemoJob-3", wait: false ) } 
0
source

Source: https://habr.com/ru/post/1269690/


All Articles