jenkins trigger build if new tag is released

Set refspec to: +refs/tags/*:refs/remotes/origin/tags/*

branch specifier: **

Under build triggers check Build when a change is pushed to GitHub


What do you mean by new tag? Does it has some template name?

You can surely define it in Advanced --> Refspec -->refs/tags/{tagname} .

You can even do refs/tags/* for finding really ANY new tags.

enter image description here


Please note that the approach in the answer provided by stanjer doesn't make Jenkins trigger builds on new tags if they point to commits that were built before. For example, you tag release v1.0.0 (to make jenkins deploy this release), then on the future you have to rollback to v1.0.0, tagging its commit again, but with v1.0.0-rollback, Jenkins won't deploy your rollback because it will check the hash the tag points to, not the hash of the tag itself.

In summary, jenkins will only build new tags if they point to commits that are not tagged already, and this is currently not tweakable.

It would be awesome if one could use Jenkins as a CD tool working with tags for deploys and rollbacks.

More info here https://groups.google.com/forum/#!msg/jenkinsci-users/mYxtDNMz1ZI/xbX9-xM9BQAJ

Tags:

Git

Tags

Jenkins