If SCMHead is not the thing you want:
You can retrieve from the git build data:
https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitSCM.java#L1328

On Wednesday, June 5, 2019 at 12:39:19 PM UTC+2, Joseph P wrote:
>
> To clarify from the SCMHead: you should be able to get the commit sha
>
> On Wednesday, June 5, 2019 at 12:37:37 PM UTC+2, Joseph P wrote:
>>
>> Jesse that is simply not true for branch source plugins:
>>
>> branch source plugin uses branch API plugin which contributes the 
>> environment variables.
>> There is also a way for plugins to retrieve this see 
>> https://github.com/jenkinsci/branch-api-plugin/blob/master/src/main/java/jenkins/branch/BranchNameContributor.java
>> and 
>> https://github.com/jenkinsci/office-365-connector-plugin/blob/8b8834c9766b12ae71820a4090caa094f66d5cf1/src/main/java/jenkins/plugins/office365connector/ActionableBuilder.java#L59-L88
>>
>> Hopefully, you find that helpful Julien
>>
>> On Wednesday, June 5, 2019 at 3:07:31 AM UTC+2, Jesse Glick wrote:
>>>
>>> On Tue, Jun 4, 2019 at 5:16 PM Julien HENRY 
>>> <[email protected]> wrote: 
>>> > Is there any simple way (except some fragile local Git operation) to 
>>> access the original Git sha1 that triggered the PR build? In my example I 
>>> need to get ab86fe3afa0b9473ea9da76c87872bf89b9b5f3b 
>>>
>>> There is not currently any environmental variable for that purpose 
>>> that I know of. You can simply try publishing a commit status for the 
>>> hash you are given, and if that gives a 422 response, try its first 
>>> parent instead, as I suggested in the thread leading to 
>>>
>>> https://jira.sonarsource.com/browse/SONAR-10794 
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/7169e402-4c4f-4d73-906f-fc72327e764f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to