It works for me using the latest git plugin (2.2.5) and the latest git
client plugin (1.10.1).

I created a job which takes a parameter TAG_TO_BUILD

I enabled Git as the SCM system, and used git://
github.com/jenkinsci/git-client-plugin.git as the URL for the repository.

I changed the "Branches to build" from the default "*/master" to
"refs/tags/${TAG_TO_BUILD}".  That syntax is listed in the help for the
"Branches to build" field as one which will build that specific tag.

I added a build step "git log -n 2" to report the last commit.

I ran the job several times, giving values like "git-client-1.10.1" and
"git-client-1.6.4" and "git-client-1.9.0".  Each time, the console output
showed that the matching git commit had been used for the checkout.

Alexander Link implemented that enhancement with his fixes in git client
plugin 1.10.0.  Refer to the
https://wiki.jenkins-ci.org/display/JENKINS/Git+Client+Plugin#GitClientPlugin-ChangeLog
for links to the two bugs which were fixed with that change.

Thanks,
Mark Waite


On Wed, Aug 27, 2014 at 10:22 AM, Sean Jones <[email protected]>
wrote:

> Does this work? I have been attempting to do this but the latest commit
> from master is always built.
>
> On Friday, April 12, 2013 2:20:08 AM UTC+1, Jon Schewe wrote:
>>
>> Are you saying that I should put "+refs/tags/*:refs/remotes/origin/tags/*"
>> in the Refspec field under advanced and "*/tags/*" in the branch specifier
>> and that will build only tags?
>>
>>
>> On Mon, Apr 8, 2013 at 7:49 AM, Christopher Orr <[email protected]> wrote:
>>
>>> Hi there,
>>>
>>> You can already do most of this with (for example):
>>>
>>> Refspec: +refs/tags/beta/*:refs/remotes/origin/tags/beta/*
>>> Branch spec: */tags/beta/*
>>>
>>> We use that config to cause a build only when a new tag called
>>> "beta/whatever" is pushed.  No branches are built.
>>>
>>> I think the one thing missing that you've added is the full wildcard
>>> support.  So maybe it would be better to add generic full wildcard support
>>> to ref- and branch-specs, rather than adding this tag-specific feature?
>>>
>>> Maybe Nicolas has some other ideas...
>>>
>>> Regards,
>>> Chris
>>>
>>>
>>>
>>> On 07/04/13 09:34, ryenus wrote:
>>>
>>>> Is there anyone interested in allowing Jenkins to build tags as well
>>>> other than just branches?
>>>>
>>>> In our team, we have a special requirement that every tag pushed to our
>>>> Git repository should trigger a Jenkins build. We've done that via some
>>>> customization to the Jenkins Git Plugin:
>>>>
>>>> I've attached the patch (based on git-1.2.0), and a screen shot of the
>>>> result build configuration section and it's working as expected.
>>>>
>>>> Notes:
>>>> 1. The patch is made in a way that by default nothing would be changed.
>>>> 2. By setting the 'Tags to build' field, you can specify shell patterns
>>>> as in `git tag -l <pattern>` to specify the tags to be built.
>>>> 3. By checking the 'Don't build branches' checkbox, branches can be
>>>> skipped
>>>>
>>>> I'm curious about whether this could be adopted by the community, and
>>>> how? I'd love to hear your feedback.
>>>>
>>>> Cheers
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Jenkins Developers" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Jenkins Developers" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>
>> --
>> http://mtu.net/~jpschewe
>>
>>   --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Thanks!
Mark Waite

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to