How to get Jenkins environment variables in Extended Choice Parameter plugin

1.9k Views Asked by At

I have to define a single select combo box where a list of available values is defined in a Jenkins environment variable (Manage Jenkins → Configure System → Global properties → Environment variables). How could I achieve that?

I tried to use build and env objects, but they are undefined.

1

There are 1 best solutions below

2
On BEST ANSWER

I found how to do it:

import hudson.slaves.EnvironmentVariablesNodeProperty
import jenkins.model.Jenkins

Jenkins.get().globalNodeProperties.get(EnvironmentVariablesNodeProperty).envVars['VARIABLE_NAME']