groovy - Jenkins Pipeline - how to get values after parallel execution -
is possible save values during parallel execution , use these values during final step?
in following example, know jenkins slave used during parallel execution , use during final step.
node { stage 'checkout' checkout([...]) stash includes: '**', name: 'binary' stage 'running simulation' parallel ( "stream 1" : { node { unstash "binary" sh "echo \"\$(whoami)@\$(hostname):\$pwd\"" // how save previous result // run simulation on node first slave ... } }, "stream 2" : { node { unstash "binary" sh "echo \"\$(whoami)@\$(hostname):\$pwd\"" // how save previous result // run simulation on node second slave ... } } ) stage 'gathering results files' // use values of slaves retrieve files. stage 'generate report' }
thanks answer.
my bad, using 2.3 version of pipeline nodes , processes plugin. works fine version 2.5
hostname = sh (returnstdout: true, script: 'hostname') println hostname
Comments
Post a Comment