Skip to content
Browse files
Merge pull request #508 from jglick/buildEnv
[JENKINS-26100] Supply GitSCM/buildEnv
  • Loading branch information
MarkEWaite committed Jun 30, 2017
2 parents 87a76ef + 53984ad commit 2cfbf64ed55f9a23ccd576c66fa4deb83dabe91a
@@ -1286,6 +1286,7 @@ public void buildEnvironment(Run<?, ?> build, java.util.Map<String, String> env)
String remoteBranchName = getBranchName(branch);
env.put(GIT_BRANCH, remoteBranchName);

// TODO this is unmodular; should rather override LocalBranch.populateEnvironmentVariables
LocalBranch lb = getExtensions().get(LocalBranch.class);
if (lb != null) {
// Set GIT_LOCAL_BRANCH variable from the LocalBranch extension
@@ -0,0 +1,10 @@
package hudson.plugins.git.GitSCM;

def l = namespace(lib.JenkinsTagLib)

// TODO handle GitSCMExtension.populateEnvironmentVariables somehow, say by optionally including GitSCMExtension/buildEnv.groovy; though GIT_{COMMITTER,AUTHOR}_{NAME,EMAIL} are only overridden by UserIdentity
l.buildEnvVar(name: name) {
@@ -0,0 +1,10 @@
GIT_COMMIT.blurb=The commit hash being checked out.
GIT_PREVIOUS_COMMIT.blurb=The hash of the commit last built on this branch, if any.
GIT_PREVIOUS_SUCCESSFUL_COMMIT.blurb=The hash of the commit last successfully built on this branch, if any.
GIT_BRANCH.blurb=The remote branch name, if any.
GIT_LOCAL_BRANCH.blurb=The local branch name being checked out, if applicable.
GIT_URL.blurb=The remote URL. If there are multiple, will be <code>GIT_URL_1</code>, <code>GIT_URL_2</code>, etc.
GIT_COMMITTER_NAME.blurb=The configured Git committer name, if any.
GIT_AUTHOR_NAME.blurb=The configured Git author name, if any.
GIT_COMMITTER_EMAIL.blurb=The configured Git committer email, if any.
GIT_AUTHOR_EMAIL.blurb=The configured Git author email, if any.

0 comments on commit 2cfbf64

Please sign in to comment.