Skip to content

Instantly share code, notes, and snippets.

@indyfromoz
Created October 22, 2018 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save indyfromoz/bc3b9afa07988ff15ec6cc097282ac12 to your computer and use it in GitHub Desktop.
Save indyfromoz/bc3b9afa07988ff15ec6cc097282ac12 to your computer and use it in GitHub Desktop.
Build identifiers
ext {
// Assumes Git is in your PATH
commitCount = {
return 'git rev-list --count HEAD'.execute().text.trim()
}
gitSha = {
return 'git rev-parse --short HEAD'.execute().text.trim()
}
buildTimestamp = {
def df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'")
df.setTimeZone(TimeZone.getTimeZone("UTC"))
return df.format(new Date())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment