Skip to content

Commit

Permalink
[FIXED JENKINS-25164] Add JOB_BASE_NAME env var (#2321)
Browse files Browse the repository at this point in the history
* [JENKINS-25164] Add SHORT_JOB_NAME env var

* Delete strip off

* [JENKINS-25164] Change SHORT_JOB_NAME for LEAF_JOB_NAME

* [JENKINS-25164] Change LEAF_JOB_NAME for JOB_BASE_NAME
  • Loading branch information
fbelzunc authored and oleg-nenashev committed May 12, 2016
1 parent 732696b commit 4bab363
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions core/src/main/java/hudson/model/Job.java
Expand Up @@ -369,6 +369,7 @@ public EnvVars getCharacteristicEnvVars() {
env.put("JENKINS_SERVER_COOKIE",SERVER_COOKIE.get());
env.put("HUDSON_SERVER_COOKIE",SERVER_COOKIE.get()); // Legacy compatibility
env.put("JOB_NAME",getFullName());
env.put("JOB_BASE_NAME", getName());
return env;
}

Expand Down
Expand Up @@ -3,7 +3,7 @@ package jenkins.model.CoreEnvironmentContributor;
def l = namespace(lib.JenkinsTagLib)

// also advertises those contributed by Run.getCharacteristicEnvVars()
["BUILD_NUMBER","BUILD_ID","BUILD_DISPLAY_NAME","JOB_NAME","BUILD_TAG","EXECUTOR_NUMBER","NODE_NAME","NODE_LABELS","WORKSPACE","JENKINS_HOME","JENKINS_URL","BUILD_URL","JOB_URL"].each { name ->
["BUILD_NUMBER","BUILD_ID","BUILD_DISPLAY_NAME","JOB_NAME", "JOB_BASE_NAME","BUILD_TAG","EXECUTOR_NUMBER","NODE_NAME","NODE_LABELS","WORKSPACE","JENKINS_HOME","JENKINS_URL","BUILD_URL","JOB_URL"].each { name ->
l.buildEnvVar(name:name) {
raw(_("${name}.blurb"))
}
Expand Down
@@ -1,7 +1,8 @@
BUILD_NUMBER.blurb=The current build number, such as "153"
BUILD_ID.blurb=The current build ID, identical to BUILD_NUMBER for builds created in 1.597+, but a YYYY-MM-DD_hh-mm-ss timestamp for older builds
BUILD_DISPLAY_NAME.blurb=The display name of the current build, which is something like "#153" by default.
JOB_NAME.blurb=Name of the project of this build, such as "foo" or "foo/bar". (To strip off folder paths from a Bourne shell script, try: <tt>$'{'JOB_NAME##*/}</tt>)
JOB_NAME.blurb=Name of the project of this build, such as "foo" or "foo/bar".
JOB_BASE_NAME.blurb=Short Name of the project of this build stripping off folder paths, such as "foo" for "bar/foo".
BUILD_TAG.blurb=String of "jenkins-<i>$'{'JOB_NAME}</i>-<i>$'{'BUILD_NUMBER}</i>". Convenient to put into a resource file, a jar file, etc for easier identification.
EXECUTOR_NUMBER.blurb=\
The unique number that identifies the current executor \
Expand Down

0 comments on commit 4bab363

Please sign in to comment.