Get env variable print out

27 views
Skip to first unread message

Irwan Azam

unread,
Apr 5, 2022, 12:44:44 AM4/5/22
to go-cd
HI I'm new to GOCD and currently evaluate this product to replace existing CICD pipeline . I try to do simple thing to build docker image and tag the version image to running build count from GoCD but unfortunatelly no success.

Executing simple echo ${GO_STAGE_COUNTER} not resolve to any return value instead return the original string format

gocd.png

Jason Smyth

unread,
Apr 5, 2022, 2:48:52 PM4/5/22
to go-cd
Hello,

As you have discovered, the command interpreter in GoCD is not a shell and does not perform environment variable substitution.

You can work around this limitation by explicitly invoking a shell (e.g. bash -c "echo ${GO_STAGE_COUNTER}") but the preferred method is to save the commands you want GoCD to execute into a script that is stored in your version control system and have GoCD run that.

Hope this helps,
Jason
Reply all
Reply to author
Forward
0 new messages