On Wed, Apr 14, 2021 at 12:16 PM eric.fetzer <eric.fet...@gmail.com> wrote:

> Thamks Mark!  So how would I go about checking out a branch based on a
> point in time (a label in most systems)?  Is there a way to snap a label
> and then check out based on that label or are we resigned to only deal in
> tip revisions?
>
>
You can checkout a point in time by checking out a specific SHA-1 hash
that is the most recent commit before that point in time.  See
https://stackoverflow.com/questions/6990484/how-to-checkout-in-git-by-date .


>
>
> Sent from my T-Mobile 4G LTE Device
>
>
> -------- Original message --------
> From: Mark Waite <mark.earl.wa...@gmail.com>
> Date: 4/14/21 1:44 PM (GMT-05:00)
> To: Jenkins Users <jenkinsci-users@googlegroups.com>
> Subject: Re: Git Plugin Checkout From Branch With Tag
>
>
>
> On Wed, Apr 14, 2021 at 10:22 AM Eric Fetzer <eric.fet...@gmail.com>
> wrote:
>
>> Well if I don't tell it what branch to get, how will it get the right
>> branch?  Sorry, Github is a paradigm shift for me.  I've been using
>> StarTeam for 20 years and github for just a few weeks now...
>>
>>
> No problem.  Been through that paradigm shift.  Took a long time before
> the key git concepts finally registered.
>
> A git tag represents a specific commit.  A checkout of a tag does not need
> a branch.  In your case, you're asking for a branch and a tag.  The git
> plugin decided to give you the branch instead of the tag.  If you only ask
> for a tag, it will checkout the commit at that tag.
>
> Mark Waite
>
>
>> On Wed, Apr 14, 2021 at 10:13 AM Mark Waite <mark.earl.wa...@gmail.com>
>> wrote:
>>
>>> Don't use a branch parameter.  Place the tag name in the "Branches to
>>> build" field.  Compare my screen shots and your screen shots.  You have
>>> more things in your job definition than I have in mine.  Those extra things
>>> are causing the behavior you're seeing
>>>
>>> On Wed, Apr 14, 2021 at 8:32 AM Eric Fetzer <eric.fet...@gmail.com>
>>> wrote:
>>>
>>>> So I've tried to incorporate what you've said, Mark, but it still just
>>>> clones the tip revision (9.9.9.10 in this case).  Here are my tags:
>>>>
>>>> git show-ref --tags -d
>>>> 4efbdb878c77557d050abbd228fc377adb9419b0 refs/tags/1.0.0.1
>>>> 799eda70c5f052a6f8e757b044b3b60f704a705a refs/tags/1.0.0.1^{}
>>>> c516e3681d2675d4e407b3c26ddfc7da0404c898 refs/tags/1.0.0.2
>>>> 40bf9dd858780d79facfb789921f53d673c08dc9 refs/tags/1.0.0.2^{}
>>>> 9083515085949bfad75f028194226f5a9b1e5ecf refs/tags/9.9.9.10
>>>> 49b0f2cfbf93f36acf6b2124d589a64940eecf18 refs/tags/9.9.9.10^{}
>>>> 019b3f3c634b9071c43f570a62c1191be05c0f4e refs/tags/9.9.9.9
>>>> b2f49473794ad74af0e5943f9292e57e05938fbe refs/tags/9.9.9.9^{}
>>>>
>>>> I'm trying to get 9.9.9.9.  Here is my setup:
>>>>
>>>> [image: image.png]
>>>>
>>>> [image: image.png]
>>>>
>>>> It is honoring the branch specifier for branch, but not for tag.  I've
>>>> tried it with just ${tag_name} as well as with tags/${tag_name} as well as
>>>> refs/tags/${tag_name}.  What am i doing wrong?  Thanks!!!
>>>>
>>>> On Wed, Apr 14, 2021 at 8:06 AM Eric Fetzer <eric.fet...@gmail.com>
>>>> wrote:
>>>>
>>>>> Thanks for the detailed description Mark!  Only one thing confuses me,
>>>>> I don't see you specifying the branch to build anywhere in there.  Can you
>>>>> explain that to me because I have to specify the branch as well as the 
>>>>> tag?
>>>>>
>>>>> On Tue, Apr 13, 2021 at 7:42 PM Mark Waite <mark.earl.wa...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>>
>>>>>>
>>>>>> On Tue, Apr 13, 2021 at 5:57 PM eric.fetzer <eric.fet...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> I am SO sorry Mark, I confused this Jenkins thread with a totally
>>>>>>> unrelated support ticket.  I'm not using pipeline, just the git plug in 
>>>>>>> in
>>>>>>> conjuction with git parameters.  What exactly do you mean by fetching 
>>>>>>> the
>>>>>>> tags?
>>>>>>>
>>>>>>>
>>>>>> I defined a Jenkins Freestyle job that fetches a specific tag and
>>>>>> verifies within the job that the specific tag was fetched.  You can read
>>>>>> the job definition
>>>>>> <https://github.com/MarkEWaite/docker-lfs/blob/lts-with-plugins/ref/jobs/Bugs-Individual/jobs/Bugs-10-000-to-19-999/jobs/JENKINS-15259-publisher-tags-wrong-commit/config.xml>
>>>>>> if that helps.
>>>>>>
>>>>>> Crucial portions of the job definition included:
>>>>>>
>>>>>> *Define the parameter for the tag to checkout*
>>>>>>
>>>>>> [image: parameterized-job-definition.png]
>>>>>>
>>>>>> *Use the parameter in the checkout as the local branch name*
>>>>>>
>>>>>> [image: repository-definition.png]
>>>>>>
>>>>>> I believe the default behavior is to fetch tags, but I included it in
>>>>>> the job definition as part of "Advanced clone behaviors" to be certain.
>>>>>>
>>>>>> I enabled "Honor refspec on initial clone" because that test
>>>>>> repository is very large and I only wanted a specific branch in the 
>>>>>> clone.
>>>>>> You  probably won't need that option, though it does no harm to enable 
>>>>>> it.
>>>>>>
>>>>>> Mark Waite
>>>>>>
>>>>>>
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Sent from my T-Mobile 4G LTE Device
>>>>>>>
>>>>>>>
>>>>>>> -------- Original message --------
>>>>>>> From: Mark Waite <mark.earl.wa...@gmail.com>
>>>>>>> Date: 4/13/21 7:29 PM (GMT-05:00)
>>>>>>> To: Jenkins Users <jenkinsci-users@googlegroups.com>
>>>>>>> Subject: Re: Git Plugin Checkout From Branch With Tag
>>>>>>>
>>>>>>> As far as I can tell, you didn't provide the context of the old
>>>>>>> conversation.  The steps you've attempted and the context where you're
>>>>>>> trying those steps are not clear to me.  The comments that follow are my
>>>>>>> guesses of things that might help you.
>>>>>>>
>>>>>>> If you're using Jenkins Pipeline and want to checkout a tag in your
>>>>>>> parameterized job, you must use the 'checkout scm' step
>>>>>>> <https://www.jenkins.io/doc/pipeline/steps/workflow-scm-step/>
>>>>>>> rather than the 'git' step
>>>>>>> <https://www.jenkins.io/doc/pipeline/steps/git/>.  The Pipeline
>>>>>>> snippet generator
>>>>>>> <http://jenkins.io/redirect/pipeline-snippet-generator> will help
>>>>>>> you generate the correct syntax for your desired checkout.  There is a 
>>>>>>> brief
>>>>>>> video <https://youtu.be/ai1kf4ihZUo> included in the git plugin
>>>>>>> documentation <https://plugins.jenkins.io/git/#pipelines> that
>>>>>>> shows how to use the Pipeline snippet generator.  The git
>>>>>>> step documentation <https://www.jenkins.io/doc/pipeline/steps/git/>
>>>>>>> warns that 'checkout' is the preferred step and that tag checkout is not
>>>>>>> supported with the git step.
>>>>>>>
>>>>>>> If you're using a Freestyle job, then you may need to check that
>>>>>>> you're fetching the tags and that the tag parameter you're providing is
>>>>>>> being placed in the "Branch to build" as a variable to be expanded.
>>>>>>>
>>>>>>> Mark Waite
>>>>>>> On Tuesday, April 13, 2021 at 1:21:39 PM UTC-6 eric....@gmail.com
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Tried a bunch more stuff using Git Parameters:
>>>>>>>>
>>>>>>>> https://plugins.jenkins.io/git-parameter/
>>>>>>>>
>>>>>>>> Again, I can checkout from the branch, but not using the tag.  I
>>>>>>>> set a git parameter for branch and then put it in the branch specifier 
>>>>>>>> and
>>>>>>>> that worked.  I added another for tag, then put that in the same branch
>>>>>>>> specifier after a space and got an error.  If I put it in an additional
>>>>>>>> branch specifier, it seems to have gotten ignored.  Just got the tip
>>>>>>>> revision from that branch.
>>>>>>>>
>>>>>>>> On Tue, Apr 13, 2021 at 12:57 PM eric....@gmail.com <
>>>>>>>> eric....@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> OK, I think I've tried everything in this OLD conversation, but
>>>>>>>>> none of them work.  I have no issues checking out from a branch using
>>>>>>>>> branch specifier.  I've tried adding on to the specifier:  
>>>>>>>>> ${my_branch}
>>>>>>>>> tags/${my_tag}.  Have also added another branch and used this sort of 
>>>>>>>>> thing
>>>>>>>>> (as well as every other way they said to do it in that thread).  
>>>>>>>>> Every way
>>>>>>>>> seems to just get the tip revision of all the files in that branch.  
>>>>>>>>> Does
>>>>>>>>> anyone have guidance of how to get this done?  Thanks!  Eric
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> You received this message because you are subscribed to a topic in
>>>>>>>>> the Google Groups "Jenkins Users" group.
>>>>>>>>> To unsubscribe from this topic, visit
>>>>>>>>> https://groups.google.com/d/topic/jenkinsci-users/UGyBIx3pX9s/unsubscribe
>>>>>>>>> .
>>>>>>>>> To unsubscribe from this group and all its topics, send an email
>>>>>>>>> to jenkinsci-use...@googlegroups.com.
>>>>>>>>> To view this discussion on the web visit
>>>>>>>>> https://groups.google.com/d/msgid/jenkinsci-users/c045a834-8d68-46fe-8b72-860e89416209n%40googlegroups.com
>>>>>>>>> <https://groups.google.com/d/msgid/jenkinsci-users/c045a834-8d68-46fe-8b72-860e89416209n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>>> .
>>>>>>>>>
>>>>>>>> --
>>>>>>> You received this message because you are subscribed to a topic in
>>>>>>> the Google Groups "Jenkins Users" group.
>>>>>>> To unsubscribe from this topic, visit
>>>>>>> https://groups.google.com/d/topic/jenkinsci-users/UGyBIx3pX9s/unsubscribe
>>>>>>> .
>>>>>>> To unsubscribe from this group and all its topics, send an email to
>>>>>>> jenkinsci-users+unsubscr...@googlegroups.com.
>>>>>>> To view this discussion on the web visit
>>>>>>> https://groups.google.com/d/msgid/jenkinsci-users/54da0d5e-e11e-4564-a7b4-c2a49f94efaan%40googlegroups.com
>>>>>>> <https://groups.google.com/d/msgid/jenkinsci-users/54da0d5e-e11e-4564-a7b4-c2a49f94efaan%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>>
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "Jenkins Users" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send an email to jenkinsci-users+unsubscr...@googlegroups.com.
>>>>>>> To view this discussion on the web visit
>>>>>>> https://groups.google.com/d/msgid/jenkinsci-users/60762fe0.1c69fb81.51b85.e697%40mx.google.com
>>>>>>> <https://groups.google.com/d/msgid/jenkinsci-users/60762fe0.1c69fb81.51b85.e697%40mx.google.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to a topic in
>>>>>> the Google Groups "Jenkins Users" group.
>>>>>> To unsubscribe from this topic, visit
>>>>>> https://groups.google.com/d/topic/jenkinsci-users/UGyBIx3pX9s/unsubscribe
>>>>>> .
>>>>>> To unsubscribe from this group and all its topics, send an email to
>>>>>> jenkinsci-users+unsubscr...@googlegroups.com.
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtGWDMtyBiP%3D3BtFPcr%3Drz7E6wxpEu3gcg2MXZZMFwmUpA%40mail.gmail.com
>>>>>> <https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtGWDMtyBiP%3D3BtFPcr%3Drz7E6wxpEu3gcg2MXZZMFwmUpA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Jenkins Users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to jenkinsci-users+unsubscr...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/jenkinsci-users/CAByBicbGY6zUALbS2ApvuFVv2Aa1ggUxfE5kQF2vYguHeCEPSQ%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/jenkinsci-users/CAByBicbGY6zUALbS2ApvuFVv2Aa1ggUxfE5kQF2vYguHeCEPSQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Jenkins Users" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/jenkinsci-users/UGyBIx3pX9s/unsubscribe
>>> .
>>> To unsubscribe from this group and all its topics, send an email to
>>> jenkinsci-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtESHA%2BspxLHvufnWx_sPyOXHQszn7TMgubsjw8SL1p0cA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtESHA%2BspxLHvufnWx_sPyOXHQszn7TMgubsjw8SL1p0cA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to jenkinsci-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jenkinsci-users/CAByBicZNnvSTE5yMsPLzRW92QYtA2VFJBCpGzuLWmES58FMpZw%40mail.gmail.com
>> <https://groups.google.com/d/msgid/jenkinsci-users/CAByBicZNnvSTE5yMsPLzRW92QYtA2VFJBCpGzuLWmES58FMpZw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Jenkins Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/jenkinsci-users/UGyBIx3pX9s/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtGSgw8%2BB3CYSB_sYk2qBegE0mVhpDW%2BEStFpf_2XxT5JA%40mail.gmail.com
> <https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtGSgw8%2BB3CYSB_sYk2qBegE0mVhpDW%2BEStFpf_2XxT5JA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/60773155.1c69fb81.6a883.10c8%40mx.google.com
> <https://groups.google.com/d/msgid/jenkinsci-users/60773155.1c69fb81.6a883.10c8%40mx.google.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtGqzU-Q%3Dx4wrkgKWjP6fi%3DDX8uRQcYPqtLEB4%3DNrWRxdA%40mail.gmail.com.

Reply via email to