On Thu, Oct 25, 2012 at 11:44 AM, Xavier Nodet <xavier.no...@gmail.com>wrote:

> Hello,
>
> I am starting to use email-ext, editing the provided groovy-text. template.
> In the general case, how am I supposed to determine what git ID was used
> for the build (assuming the build uses Git, of course...)
>
> I know how to get this information from the latest change when there is
> one:
>
> <%
> def changeSet = build.changeSet
> if (changeSet != null && !changeSet.isEmptySet()) {
>   def lastGitId = "";
>   changeSet.each() { cs ->
>      lastGitId = cs.commitId
>   }
>   %>Git id: ${lastGitId}
> <%
> }
>
> But this will only work when there are actual changes, of course...
>
> Still, even if there are no changes, Jenkins knows what revision was used
> for a build.
> How to go from an AbstractBuild to the git Id?
>
> Thanks.
>
> --
> Xavier Nodet
>
>
Is it part of the build variables? build.buildVariables is a Map<String,
String>.

slide

-- 
Website: http://earl-of-code.com

Reply via email to