Skip to content

Commit

Permalink
Added EXECUTOR_COUNT to environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
ArturHarasimiuk committed Jun 14, 2019
1 parent 0312f25 commit 4def63d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public void buildEnvironmentFor(Job j, EnvVars env, TaskListener listener) throw
Node n = e.getOwner().getNode();
if (n != null)
env.put("NODE_LABELS", Util.join(n.getAssignedLabels(), " "));
env.put("EXECUTOR_COUNT", String.valueOf(e.getOwner().countExecutors()));
}
}
}
Original file line number Diff line number Diff line change
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", "JOB_BASE_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_COUNT","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
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ BUILD_DISPLAY_NAME.blurb=The display name of the current build, which is somethi
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>". All forward slashes ("/") in the JOB_NAME are replaced with dashes ("-"). Convenient to put into a resource file, a jar file, etc for easier identification.
EXECUTOR_COUNT.blurb=Number of executors available on currently running node
EXECUTOR_NUMBER.blurb=\
The unique number that identifies the current executor \
(among executors of the same machine) that\u2019s \
Expand Down

0 comments on commit 4def63d

Please sign in to comment.