Specifically for windows tasks, "*<arg>%GO_PIPELINE_COUNTER%</arg>*" should work, since Windows commands are executed via exec
https://docs.gocd.org/current/faq/dev_use_current_revision_in_build.html#2-using-an-environment-variable-in-a-custom-command-on-windows If that's not working, I'll take a look - might need to update the documentation at the very least. If it's not working, I have a suspicion I know what "broke" it - there were MANY issues earlier with spaces and quoting and arg splitting on Windows and a side effect of fixes for those *might* have been to affect this. :-) There will be workarounds involving using cmd /c /s or powershell directly so ensure you get a variable for the "shell" to interpolate, but maybe we start with trying to see whether it works "as documented". -Chad On Fri, Oct 18, 2024 at 8:50 AM Michael Foster <[email protected]> wrote: > I'm using GoCD in Windows environments, and trying to use the standard > environment variable GO_PIPELINE_COUNTER to enumerate things distinctly. > But I can't get any standard environment variable to work, such as with > this kind of command: > ``` > <jobs> > <job name="PullAndUpdate"> > <tasks> > <exec command="echo"> > <arg>${env.GO_PIPELINE_COUNTER}</arg> > <runif status="passed" /> > </exec> > ``` > I've tried with and without braces and parentheses, and with $ and % (# is > apparently only for parameters), and with and without "env.". Anything I > try just gives me the literal text as output. > > Is there any way to actually USE the standard environment variables within > a pipeline? > > > Thank you!!! Michael F. > > -- > 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/2271247d-94f9-4800-b10d-3c00e0c3029en%40googlegroups.com > <https://groups.google.com/d/msgid/go-cd/2271247d-94f9-4800-b10d-3c00e0c3029en%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAA1RwH_G2cgmMTdAzvS9PhYyyz4HOWcXTTk99nhzFW%3DiZLF6YA%40mail.gmail.com.
