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, On Sun, Dec 27, 2020 at 10:24 PM gdlai cn <[email protected]> wrote: > 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? > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/go-cd/cafc5439-b49f-4202-b578-d486baefa388n%40googlegroups.com > <https://groups.google.com/d/msgid/go-cd/cafc5439-b49f-4202-b578-d486baefa388n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Ashwanth Kumar / ashwanthkumar.in -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/CAD9m7CwytWt3EioZmWJhXfSoFBQ4tVjY%2BW-xG6NTBVE2-bw5GA%40mail.gmail.com.
