i want set environment variable GO_PIPELINE_COUNTER in task command

104 views
Skip to first unread message

gdlai cn

unread,
Dec 27, 2020, 11:54:09 AM12/27/20
to go-cd
i want set environment variable GO_PIPELINE_COUNTER in task command, but it dont't work.

at task command,i try like this: ${GO_PIPELINE_COUNTER},or %GO_PIPELINE_COUNTER%, but all not work.

how to do?

Ashwanth Kumar

unread,
Dec 30, 2020, 8:15:16 PM12/30/20
to go...@googlegroups.com
GoCD's Agent architecture doesn't run the entire job (within a stage) in a single shell. So if you export / set an environment variable in one task and try to access it in the next. It wouldn't work. I would suggest using a BAT/PS script (if you're on Windows) or shell script (if you're on Linux / Mac) to automate your workflows. Also it is a good practice to keep the job specific sequence of tasks outside GoCD so your CI/CD workflow is not tightly coupled to your CI/CD system.

Thanks,


--
You received this message because you are subscribed to the Google Groups "go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to go-cd+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/cafc5439-b49f-4202-b578-d486baefa388n%40googlegroups.com.


--

Ashwanth Kumar / ashwanthkumar.in

Irwan Azam

unread,
Apr 5, 2022, 9:10:41 AM4/5/22
to go-cd
I'm also facing the same problem. The variable is set in the same task instance.

raja sekhar

unread,
May 4, 2022, 3:10:35 PM5/4/22
to go-cd
Hi , 

You should use this environment variable to get counter. 

Example : ${GO_PIPELINE_COUNTER}
Reply all
Reply to author
Forward
0 new messages