I'm trying to get Jenkins' multibranch pipeline job to build tags in a similar manner to branches. In Jenkins 2.73 (not sure when the functionality was added), Multibranch projects can be configured to retrieve both branches and tags from the source repository. Initially I thought this would be perfect for my needs (my Jenkinsfile can now build development or production builds from the same place in Jenkins). Multibranch job with tags discovery configured
I have the build process itself up and running quite happily with a scripted pipeline, however my issue is that whilst the branch jobs pickup my triggers perfectly (Cron weekly) and are thus triggerable using the Git plugin's notifyOnCommit functionality (allows me to clean build weekly, but build on commit to the repo as well via a repo scan webhook), tag builds do not.
Has anyone else come across this? If so, have you found any reasonable way to resolve it?
Relevant snippet from my scripted pipeline (I tried with and without the overrideIndexTriggers
setting):
properties(
[
pipelineTriggers(
triggers: [
cron('H 02 * * 7')
]
),
overrideIndexTriggers(true)
]
)
Polling configuration from a branch job generated by the multibranch pipeline seems fine Jobs generated from tags by the multibranch pipeline do not receive the same configuration, bizarrely...
There is a note in the multibranch pipeline scan log that suggests that Tags will never be auto-scheduled:
Processed 8 branches
Checking tags...
Checking tag testing
‘Jenkinsfile’ found
Met criteria
No automatic builds for testing
Processed 1 tags
[Mon Oct 23 09:55:00 UTC 2017] Finished branch indexing. Indexing took 8.1 sec
Finished: SUCCESS
My project is docker based and I would like to run a release build weekly, to pull in any base-image changes etc.
Does anyone have any ideas about what I can do to get multi-branch projects to schedule tag builds?
Not automatically triggering a build for discovered tags seems to be by design according to JENKINS-47496. Stephen Connolly offers an explanation and suggestion for what you might do: