Git plugin setting GIT_COMMIT to value of last hash??

24 views
Skip to first unread message

Brantone

unread,
Mar 22, 2016, 8:41:34 PM3/22/16
to Jenkins Users
Hello,

We have a quirky situation we're trying to track down ... on random occasions, the environment variable value for "GIT_COMMIT" is actually set to the hash for the last commit instead of the current one, as the docs outline (https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin).
The actual check out and console output shows the correct value of the hash, and also shows the value of the last checkout for "git rev-list" to be able to get the changelog... However, viewing Environment Variables (via /injectedEnvVars/ on the build) ... the value for GIT_COMMIT is the last hash ... which screws up some downstream jobs.

Looking at the plugin code the function "buildEnvVars" (https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitSCM.java#L1238) starts off with function call "getLastBuiltRevision", which gets used through to set the GIT_COMMIT, presumably trampling the value that was set during the checkout.

I'm still tracing the circumstances/stacktrace where this happens, but wondering if anyone else has hit this, or knows the reason for EnvVars to use last revision.... if not, I sense a ticket coming, to add to the queue of almost 300.

Cheers.
Reply all
Reply to author
Forward
0 new messages