Something obvious is missing. How to pass a variable from groovy script to a shell command? This is in the context of the Jenkins file, if that matters for the syntax.
def COLOR node('nodename'){ stage ('color') { COLOR = "green" echo "color is $COLOR" sh '''COLOR=${COLOR} echo $COLOR''' } }
I expect the shell text to print green , but I get the following:
[Pipeline] echo color is green [Pipeline] sh [job] Running shell script + COLOR= + echo
I need to use triple quoting on sh because of the content that will go through there as soon as I get this fix.
source share