I have been thinking about how to release with Gradle without any bump commits like you get with Maven release plugin.
I have changed the multibranch pipeline SCM configuration to Discover tags. It does discover new tags, but it doesn't start an automatic build.
The idea was to manually create the git tag, then Jenkins would discover it and start to build it.
To distinguish in my build script that this is a release build, I am checking that tag name is equal to branch name environment variables.
final def tagName = env.TAG_NAME
final def branchName = env.BRANCH_NAME
def releaseBuild = false
if (branchName.equals(tagName)) {
releaseBuild = true
}
It seems it is intended functionality that Jenkins isn't building tags automatically.
The recommended solution is to create a Jenkins branch-api extension plugin that does the trick.
Stephen Connolly suggested three implementations of BranchBuildStrategy.
One for ChangeRequestSCMHead, second for regular branches and the third for TagSCMHead with a timestamp check.
1) There is no option in configuration on Branch Source to add Build strategies. Only Property strategies, unless that is the same thing?
2) Could not find any existing plugins that can add different build strategies.