~drscream

Build last git tag with Jenkins

Sometimes it’s required to build the last tag of your software with Jenkins. Mostly I use it to build a last stable release automatically with Jenkins.

I use GitHub for my software so I use by default tags for each release. Every tag contains a version number which could be automatically filtered by Jenkins.

Build last git tag with Jenkins

Use the advanced button for git and specify a refspec in the Jenkins that only selects these tags:

+refs/tags/*:refs/remotes/origin/tags/*

In the branch specifier specify:

*/tags/*

  1. Vikram says:

    Sun 20/03/16, 4:20 pm

    Hi Thomas, I am trying to setup Jenkins job which triggers whenever there is new tag on any of the branches of a GitHub repo. After setting up job per your comments , I have manually added a new tag in master branch as per https://help.github.com/articles/creating-releases/ But the job didn't get triggered. I checked the Git Polling log , it does show the latest tag but job didn't get triggered . Can you please clarify ? Thanks & Regards, Vikram

    /

  2. drscream says:

    Mon 21/03/16, 10:25 pm

    Hello Vikram, thanks for your email, but I think you misunderstand my blog post. The post doesn’t describe any trigger or configuration option to support the GitHub trigger / webhook. I’ve only tested my setup by using Jenkins as master and press the build button at Jenkins itself. best regards, Thomas

    /

Send your comment by mail.