Accessing Special Built-In Jenkins Variables List

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Accessing Special Built-In Jenkins Variables List

Ven H
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

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPp28eqO7yOo1-4C8Rbi%2B-K6XkK%3DvupgTQDW90-sR119zSB19Q%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Accessing Special Built-In Jenkins Variables List

Ven H
Although, we can get it using the env.getEnvironment() array, but it doesn't have ${WORKSPACE} variable.

Regards,
Venkatesh


On Wed, Dec 16, 2020 at 6:16 PM Ven H <[hidden email]> wrote:
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

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPp28erX-njRk0xt6eERcPMteFtLx8%3Dr59Ej6TsNDs_CuFNVcA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Accessing Special Built-In Jenkins Variables List

Ven H
And other variables like ${NODE_NAME} are also not available through env global variables.

Regards,
Venkatesh


On Wed, Dec 16, 2020 at 6:28 PM Ven H <[hidden email]> wrote:
Although, we can get it using the env.getEnvironment() array, but it doesn't have ${WORKSPACE} variable.

Regards,
Venkatesh


On Wed, Dec 16, 2020 at 6:16 PM Ven H <[hidden email]> wrote:
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

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPp28epfySdJ_KuHb54VTaGzeMj-9X6FDBqeQp%3Dp%2BQcZBjFXMw%40mail.gmail.com.