How can i trigger a build by tag?

237 views
Skip to first unread message

ziggy

unread,
Feb 5, 2012, 10:17:07 AM2/5/12
to Jenkins Users
Is it possible to create a new job that is triggered if a new tag is
applied? For example if i apply a tag called PROJA-0.0.1-LIVE i would
like jenkins to automatically check out and build. The version number
changes everytime a tag is applied so if possible i would like to use
something like a regular expression. i.e. any tag that contains the
string %LIVE% should trigger a build. Is this possible with CVS
or Subversion CM?

David Weintraub

unread,
Feb 5, 2012, 3:22:48 PM2/5/12
to jenkins...@googlegroups.com
Yes. You can if you're building Subversion. You can have a tag that's constant like BUILD. When that tag changes, Jenkins will build based upon that tag.

However the purpose of Jenkins is a continuous build server. Building only occasionally only when you tag seems to defeat the purpose
--
David Weintraub
qaz...@gmail.com

Jon Schewe

unread,
Feb 5, 2012, 6:49:26 PM2/5/12
to jenkins...@googlegroups.com
I too would like to do this, except for git. I suspect he's not ONLY building when the tag is applied, but rather doing like I do and use Jenkins to create releases. So when a tag is applied I'd like Jenkins to build a new release to ship to the customer.
--
Jon Schewe | http://mtu.net/~jpschewe


Qazwart

unread,
Feb 5, 2012, 8:22:44 PM2/5/12
to jenkins...@googlegroups.com, jenkins...@googlegroups.com
I'm not 100% sure how git does tagging, but you could use branches to do something similar. After all, the difference between a branch and a tag in Subversion is that one is written to a directory called "tags" and one is written to a directory called "branches". Just create a release branch and copy the files to there. When the branch is updated, you get a build. 

However the power of Jenkins is continuous builds where you build and test each change. That way, you find problems early. 

What we do is a continuous build, and we actually release from one of Jenkins' builds — no special release build needed, so we can release immediately without doing a new build. 

If you only build upon release, how do you test your changes?

--
David Weintraub
Sent from my iPhone while riding in my Ferrari. (Jealous?)

Ziggy

unread,
Feb 6, 2012, 8:32:29 AM2/6/12
to jenkins...@googlegroups.com
The problem i have is that in our environment we don't build from Trunc. See this post for a summary of how we use CVS and subversion - http://stackoverflow.com/questions/9149540/continous-integration-with-subversion-and-cvs

On our environment, trunc is never stable. Only tagged versions are stable. It does not make sense for us to build from trunc as it sometimes includes incomplete artifacts. When a release is ready to be checked out, built and tested, a developer would tag the necessary files (excluding the work in progress) artifacts and checkout using the new tag.

I would like the CI environment to checkout the code using the new tag when someone tags a specific snapshot with a tag that has the text %LIVE% in the tag. This way the CI will checkout a stable release and perform the necessary tests. 

Could you elaborate a bit more about the constant BUILD tag. How would this work?

Thanks


David Weintraub

unread,
Feb 6, 2012, 10:36:57 AM2/6/12
to jenkins...@googlegroups.com
I don't know if you're using CVS that Jenkins is able to look at the
tag to see if it has been modified. There's a checkbox you select if
your specifying a tag instead of a branch in your CVS specification.

However, you can do the same thing using a branch instead of a tag.
Create a branch called BUILD, and have your developers copy trunk over
to that branch when they want a build. You can even have Jenkins
create an actual tag for you during the build process with the build
number as part of the tag.

If you're using Subversion, you can use either a tag or a branch using
the "svn delete" and "svn cp" command. Again, you can have Jenkins
create a tag for your build based upon the build number.

In Git, CVS, and Subversion, there are Jenkins plugins that allow you
to tag a build after it occurred. Just select the tag task from the
left-hand side of the screen, specify the tag, and let Jenkins handle
the rest.

--
David Weintraub
qaz...@gmail.com

Ziggy

unread,
Feb 6, 2012, 12:12:37 PM2/6/12
to jenkins...@googlegroups.com
Ok will try that - Thanks.
Reply all
Reply to author
Forward
0 new messages