I've seen a few discussions on this but can't seem to wrap my head around what GoCD is doing under the covers in order to get this to work.
I am running a couple of groovy scripts and/or remote ssh commands that I want to parameterize using an environment variable defined at the pipeline level.
In this case I want to define an environment variable called "DEPLOY_ENV":

and have it substituted in the locations for both a '/bin/bash' and 'groovy' command noted below:
<exec command="/bin/bash">
<arg>sshpass -mypass ssh -o StrictHostKeyChecking=no user@salt-server "mkdir -p /srv/pillar/$DEPLOY_ENV/myservice" && sshpass -mypass scp ./myservice_materials/pillar/$DEPLOY_ENV/* myuser@salt:/srv/pillar/$DEPLOY_ENV/myservice</arg>
<runif status="passed" />
<arg>./continuous-deployment/groovy/src/gocd/OrchestrateSaltApi.groovy</arg>
<arg>./myservice_materials/pillar/$DEPLOY_ENV/salt-api_request.json</arg>
<runif status="passed" />
I've tried the following variations with the same error:
I don't really care that it is an environment variable, as long as I can define it once at the pipeline level and reuse it in multiple stages/jobs/tasks.
Any guidance is much appreciated!
--