How to automatically triggers Jenkins job when there is a Git tag push to Bitbucket server or git tag created from a branch in BB?

I have a multibranch pipeline configured, Jenkins job triggers whenever there is code commit, PR, merge. The automatic trigger works as expected but issue is when there is a git tag push or when a git tag is created from a branch, it does not automatically trigger the Jenkins job. The only way to trigger it is by manual build from Jenkins UI.

If you click build in Jenkins UI, it will trigger and start the build process but will never trigger when you push git tag.

Is this a kind of limitation or how can I resolve this issue?

1 Like

Hi @ayodeletolu12 and welcome to this community :wave:

Please have a look at this answer and let us know if that works for you.

Basically, it asks you to install the Basic Branch Build Strategies plugin and activate the building of tags for the pipeline.

@poddingue thanks for the feedback. However, we have the Basic Branch Build Strategies plugin installed and activated on my environment but still didn’t work.

From the scan multibranch pipeline, the log shows that tags are discovered but no automatic build triggered

Checking tag ***************
      ‘Jenkinsfile’ found
    Met criteria
Changes detected: ****************** (null → ***********************************)
No automatic build triggered for TagName

Is this kind of limitation?

1 Like

I don’t think so. :thinking:

Let me try it on my Jenkins instance.

I haven’t been able to test yet, but before I do, could you please tell me if your tags are annotated?
I was discussing your issue with Damien Duportal a few minutes ago, and he told me one of the reasons your tags aren’t built could be that they are too old.

Let me try to explain what I think I understood: whenever you create a draft release, it will be associated with the date you created it. When you finalize your release and point to a certain commit, the tag is created with the date the commit was made… And if you made this commit 6 days ago, your tag will also be 6 days old… unless you annotate it, so that it is 0 days old.
Most of the time, the default tag build configuration is 3 days, so could you please check how old your tags are, and if they are annotated? I’m not familiar with BitBucket, only GitHub.

That could be the reason why the plugin does not pick your tags, or not…
Most of the time, it’s not very verbose when it finds an “outdated” tag.

I do hope I did not butcher too much Damien’s explanation.