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 t
The TAG_NAME
should work now at least in declarative pipelines.
When
condition actually filters on this property. BRANCH_NAME
has the same value.
stage('release') {
when {
tag 'release-*'
}
steps {
echo "Building $BRANCH_NAME"
echo "Building $TAG_NAME"
}
}
See https://jenkins.io/doc/book/pipeline/syntax/#when