I want Jenkins to build a certain stage only if the build runs for a branch without a tag. I am using the declarative syntax.
This is what I have so far:
stage ('Do stuff'){
when {
expression {
TAG_NAME == null
}
}
steps {
sh'''#!/bin/bash
...
'''
}
}
When running the build, I get the following error:
groovy.lang.MissingPropertyException: No such property: TAG_NAME for class: groovy.lang.Binding
Thanks in advance for your help.
I just fount about the keywords
buildingTag()andnotto accomplish my requirements. https://www.jenkins.io/doc/book/pipeline/syntax/Here the script inside the step block will only be executed if the current build has no tag.