Using "git checkout -b ${BRANCH_NAME}" as a first shell step before the 
actual build is a very elegant trick.

Thanks Mark!
Best regards,
Damien.

On Saturday, 18 February 2017 19:14:12 UTC+1, Mark Waite wrote:
>
> The git plugin defaults to performing a checkout with a detached head at 
> the SHA1 hash to be built.  There is a plugin option "LocalBranch" which 
> can assign the name of the local branch to be created at that SHA1.  If 
> that's not available from the declarative pipeline, you may be able to 
> perform a "git checkout -b branch_name" in your build step.
>
> Mark Waite
>
> On Sat, Feb 18, 2017 at 11:10 AM Damien Coraboeuf <damien.c...@gmail.com 
> <javascript:>> wrote:
>
>> Hi Mark,
>>
>> I'm also using the Pipeline Model Definition plug-in, and I think this is 
>> the culprit in this story. Using the model definition, I do not see any way 
>> to specify the "checkout scm" (as I would do in a "regular" pipeline 
>> definition).
>>
>> I'm using a versioning Gradle plugin and its output shows that we are 
>> using either a shallow clone or a detached head. I need the target branch 
>> to be checked out as a local branch.
>>
>> Best regards,
>> Damien.
>>
>>
>> On Sat, Feb 18, 2017 at 7:06 PM, Mark Waite <mark.ea...@gmail.com 
>> <javascript:>> wrote:
>>
>>> What are you observing that makes you think that shallow clone is always 
>>> enabled?
>>>
>>> The git plugin and all my work with GitHub Organization Folders 
>>> indicates that shallow clone is disabled by default for all git plugin 
>>> usage, including GitHub Organization Folders.
>>>
>>> I run a GitHub Organization Folder configuration for Jenkins git plugin 
>>> and Jenkins git client plugin development changes from my forks at 
>>> https://github.com/MarkEWaite/git-client-plugin.  If I clone that 
>>> repository with a shallow clone, there are unit tests which fail because 
>>> the tests rely on a full local history of the repository.
>>>
>>> Are you performing a "checkout scm" (or similar) in your Jenkinsfile so 
>>> that each job has its own working copy of the repository?  If so, are you 
>>> enabling shallow clone in that checkout?  If not, then you need to change 
>>> to use "checkout scm" in each Jenkinsfile.
>>>
>>> Mark Waite
>>>
>>> On Sat, Feb 18, 2017 at 10:57 AM Damien Coraboeuf <damien.c...@gmail.com 
>>> <javascript:>> wrote:
>>>
>>>> Hi,
>>>>
>>>> In order to compute versions correctly (using 
>>>> https://github.com/nemerosa/versioning), I need my projects not to be 
>>>> checked out using a shallow clone option.
>>>>
>>>> The Organization plug-in (
>>>> https://wiki.jenkins-ci.org/display/JENKINS/GitHub+Organization+Folder+Plugin)
>>>>  
>>>> does not seem to allow to disable this option. Or is it something we can 
>>>> change using the Pipeline Model Definition plug-in syntax?
>>>>
>>>> Thanks,
>>>> Damien.
>>>>
>>>> -- 
>>>> 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-use...@googlegroups.com <javascript:>.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/jenkinsci-users/69ac8ef3-010a-4a6f-8874-10a4b632dd6d%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/jenkinsci-users/69ac8ef3-010a-4a6f-8874-10a4b632dd6d%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> -- 
>>> 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/TIK6DERVZqQ/unsubscribe
>>> .
>>> To unsubscribe from this group and all its topics, send an email to 
>>> jenkinsci-use...@googlegroups.com <javascript:>.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtF7Hd1XVatjf5q4caTV6KLmrWTrnK7J7OfjAk9fPcM8yA%40mail.gmail.com
>>>  
>>> <https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtF7Hd1XVatjf5q4caTV6KLmrWTrnK7J7OfjAk9fPcM8yA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>
>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> -- 
>> 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-use...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/CAMbUmAEfvgh-nG-Ss49k6Nf69D0f%2Bgbk%2B9UJPyYYe8GY5hMhkw%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/CAMbUmAEfvgh-nG-Ss49k6Nf69D0f%2Bgbk%2B9UJPyYYe8GY5hMhkw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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/59eaffb3-dade-4989-b2dd-961fa179fc2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to