Hi

I have a pipeline which evaluates a variable to true or false, based on 
this I need to execute my next stage. I'm struggling to achieve this, 
please somebody help me as this is urgent I'm getting either pipeline 
failure or can't use when condition properly here is my snippet 

stage ('test status'){ steps { script { env['status'] = sh(script: "docker 
inspect -f {{.State.Running}} testnode", returnStatus: true) } echo 
"${env.status}" } }

that stage gives me either 0 or 1 based on container is running or not, so 
if container not running I want execute a stage where I can start container 
else if already started, then kill previous container and start the new 
process how can I achieve this please

tried this but fails 

stage('test true'){ when{ environment name:'status', value: '0' } steps { 
echo ' ------ true ----- ' } } stage('test false'){ when{ environment 
name:'status', value: '1' } steps { echo ' ------ false ----- ' } }

if container status returned one in 'test status' stage , this failes as 
first stage is testing for 0 how can I run either o or 1 condition , please 
help me.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/be3b5a70-18a4-4cd4-9896-f4d1a87f086a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to