Access to standard Jenkins environment variables.

48 views
Skip to first unread message

Fred Clausen

unread,
Jan 28, 2016, 12:07:20 AM1/28/16
to job-dsl-plugin


Hello,

Is there a way I can access to the Jenkins environment variables[1] from the DSL? I need to get the "GIT_BRANCH" and "WORKSPACE" variables. Alternatively is there some API method I can use to do this? I can only see DSL methods to *set* environment variables, nothing to access them. The standard Java System.getenv() does not return the Jenkins related variables. The sprawling Jenkins API[2] might have something but I've not been able to find something I can use so far.

Many thanks,

Fred.


Fred Clausen

unread,
Jan 28, 2016, 12:11:22 AM1/28/16
to job-dsl-plugin
Ah, after some searching of the archives in here directly (instead of general Google searches) I found the answer here


the variables are all pre-defined in the DSL e.g. WORKSPACE and GIT_BRANCH. I don't have to query the actual system environment variables.
Reply all
Reply to author
Forward
0 new messages