Accessing Special Built-In Jenkins Variables List

10 views
Skip to first unread message

Ven H

unread,
Dec 16, 2020, 7:47:59 AM12/16/20
to jenkins...@googlegroups.com
Hi,

We have special Built-In Jenkins Variables for a Job like ${JOB_NAME}, ${JOB_URL}, ${BUILD_NUMBER} etc, which can be accessed inside a Pipeline script (both Scripted and Declarative). Although, we can use these variables directly, I would like to know whether these are a part of an Array variable like env, so that I can use it to loop and get the variables instead of referencing them specifically using their names. I want to use this array inside my pipeline. It will be helpful, if someone can also provide an example. I tried searching a lot and also tried various ways, but couldn't find anything.  Please help.

Regards,
Venkatesh

Ven H

unread,
Dec 16, 2020, 7:59:05 AM12/16/20
to jenkins...@googlegroups.com
Although, we can get it using the env.getEnvironment() array, but it doesn't have ${WORKSPACE} variable.

Regards,
Venkatesh

Ven H

unread,
Dec 16, 2020, 9:30:14 AM12/16/20
to jenkins...@googlegroups.com
And other variables like ${NODE_NAME} are also not available through env global variables.

Regards,
Venkatesh

Reply all
Reply to author
Forward
0 new messages