Jenkins pipe Close (for example, in a “parallel” step)

I have a very long and complex pipeline that I rewrite after a major jenkins update.

I would like to declare my stages as variables and then execute them in the main node tag: I can do this easily for parallel stages, but I want to have the same style for the sequential one as well.

After many tests, the only way I found this work is to use “fake” parallel calls around all consecutive stages (ugly), I'm sure there is a better solution, but it seems like I can't find the right step ... to dishonor me .

Here is my example:

stage1 = { stage("one") { println "stage one" } } stage2 = { stage("two") { println "stage two" } } stage3 = { stage("three") { println "stage three" } } node { parallel ( "one" : stage1 , "two" : stage2 ) HERE I WANT TO CALL stage3 Closure, possibly giving a map like in the parallel above } 
+5
source share
1 answer

You can do this using the run method.

stage3.run()

I do not know if it is safe to use.

0
source

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


All Articles