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.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/a9006252-777f-4241-af2d-1ecf933b7283%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to