Hello,

I would like to add a build parameter "clean" which is true by default, 
but, when false, make the job skip the clean step.

Here is my script

echo "clean: ${clean}"
> node("qisrc") {
>   echo "clean: ${clean}"
>   if (clean) {
>     sh "echo clean"
>   }
>   sh "echo build"
> }
>

Here is what happens when I build with clean parameter unchecked:

Running: Print Message
> clean: false
> Running: Allocate node : Start
> Running on qisrc in /home/jenkins/jenkins/workspace/workflow
> Running: Allocate node : Body : Start
> Running: Print Message
> clean: false
> Running: Shell Script
> [workflow] Running shell script
> + echo clean
> clean
> Running: Shell Script
> [workflow] Running shell script
> + echo build
> build
> Running: Allocate node : Body : End
> Running: Allocate node : End
> Running: End of Workflow
> Finished: SUCCESS
>
>
As you can see, the variable "clean" is false as expected, but the sh "echo 
clean" command is ran anyway.

Is it expected?

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/48dbdae4-beae-4004-a44a-5f5ffcd30eeb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to