Discussion:
Multibranch Pipeline: Discover tags doesn't automatic build
Sverre Moe
2018-06-13 10:05:00 UTC
Permalink
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.
https://github.com/jenkinsci/github-branch-source-plugin/pull/158#issuecomment-331849109

Stephen Connolly suggested three implementations of BranchBuildStrategy.
https://github.com/jenkinsci/github-branch-source-plugin/pull/158#issuecomment-331851130
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.
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/3003da05-1e47-45dc-aab7-9409b6de71dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Steven Foster
2018-06-13 10:26:01 UTC
Permalink
https://plugins.jenkins.io/basic-branch-build-strategies
here is a plugin that has an auto-build strategy for tags. Once you add any
build strategy, the default auto-build behaviour is disabled so you will
need to also add build strategies for branches and PRs as appropriate.
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/512830ba-3781-4ed7-89b0-47bef9a0502c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Sverre Moe
2018-06-13 11:59:44 UTC
Permalink
Post by Steven Foster
https://plugins.jenkins.io/basic-branch-build-strategies
here is a plugin that has an auto-build strategy for tags. Once you add
any build strategy, the default auto-build behaviour is disabled so you
will need to also add build strategies for branches and PRs as appropriate.
Thanks. That is exactly what I need.
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/da65ed1f-cf86-47a3-94b5-17e7c718fecd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...