GoCD Version: 23.4.0 env vars and Job Env vars

13 views
Skip to first unread message

Sharat Gunnala

unread,
Oct 17, 2024, 8:50:03 PM10/17/24
to go-cd
I am trying to set  Environment Variables to Job Environment Variables and then use to label the run and build artifact. 
Env Var :   GLOBAL_RELEASE = X.X.X
Job Env Variable: RELEASE = ${GLOBAL_RELEASE}
Label Template ${env:RELEASE}.${COUNT}
This settings doesn't work as expected and values don't get replaced. any ideas?

Chad Wilson

unread,
Oct 17, 2024, 10:40:57 PM10/17/24
to go...@googlegroups.com
> Job Env Variable: RELEASE = ${GLOBAL_RELEASE}
> Label Template ${env:RELEASE}.${COUNT}

The label template is at the scope of the entire pipeline run, in the way it is displayed in the UI :-) By definition it cannot know about anything defined at a lower job level as it applies to the entire pipeline run (all stages, all jobs, all tasks).

You should be able to refer to GLOBAL_RELEASE, but definitely not a job environment variable. (I'm also not sure from memory that env var interpolation is support like you are doing for the job env)

https://docs.gocd.org/current/configuration/pipeline_labeling.html#using-pipeline-level-environment-variables
https://docs.gocd.org/current/faq/dev_use_current_revision_in_build.html

Perhaps you can share what you're trying to achieve with the labels, and we could suggest an alternative approach?

--
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/fbca3c18-46c2-431f-8566-9a3fd9ea1d4cn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages