ligi ligi - 1 year ago 623
Git Question

Jenkinsfile get current tag

Is there a way to get the current tag ( or null if there is none ) for a job in a Jenkinsfile? The background is that I only want to build some artifacts ( android APKs ) when this commit has a tag.
I tried:




both are always null - even though this ( ) indicates otherwise

Answer Source
sh "git tag --sort version:refname | tail -1 > version.tmp"
String tag = readFile 'version.tmp'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download