Re: How to clone a directory from a remote repo in a Jenkins pipeline script?

2019-03-27 Thread Haibrayn González
>From CLI you can 

git checkout  -- path/to/subdir/

just that you would need to be in the repository so maybe clone an empty 
branch or the first commit of the repo instead of the large repo branch and 
then checkout the files from CLI


El miércoles, 31 de mayo de 2017, 13:36:19 (UTC-5), Stephen Connolly 
escribió:
>
>
> On Wed 31 May 2017 at 16:32, Mark Allison  > wrote:
>
>>
>>>
>>> On Wed, May 24, 2017 at 9:01 AM Mark Allison  wrote:
>>>
 On Wednesday, 24 May 2017 13:29:58 UTC+1, Daniel Beck wrote:

>
> > On 24. May 2017, at 09:23, Mark Allison  wrote: 
> > 
> > I know I probably need to use sparse and/or shallow checkouts, but 
> can't seem to work out how to configure that in a Jenkins pipeline script 
> with the git plugin. Any ideas? 
>
> Use the 'checkout' step and specify Git SCM. That should allow you to 
> use all the options available in Git. Use the snippet generator for this. 
>
> Daniel, how does that show checking out a directory within a repo? Do 
 you have something more concrete? The snippet generator does not show this.

>>>
>>> Checking out to a subdirectory within a workspace requires that you nest 
>>> the checkout() step inside a dir("subdir-name") step.  The snippet 
>>> generator only shows one at a time (as far as I recall), so it won't show 
>>> you that combination.
>>>
>>> Refer to 
>>> https://github.com/MarkEWaite/jenkins-bugs/blob/JENKINS-43052/Jenkinsfile 
>>> for 
>>> an example of that technique.
>>>
>>
>> Hi Mark,
>>
>> I am trying to checkout FROM a remote subdirectory within a repo not to a 
>> subdirectory. Does anyone know how to do that with the git plugin?
>>
>
> Git doesn't really do that.
>
> I'd probably see if there is a command from the CLI that does what you 
> want and then just use a `sh` step to do that
>
> (I'm betting there is no such CLI command BTW)
>
> -- 
>> 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 jenkins...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/c90805be-fae3-4f26-bc85-c9e8c1f45e29%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> -- 
> Sent from my phone
>

-- 
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/810a955c-2452-4408-af78-7df65246db67%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to clone a directory from a remote repo in a Jenkins pipeline script?

2019-03-27 Thread Haibrayn González
Check out the snippet for git: checkout and try the sparse checkout 
advanced option

checkout changelog: false, poll: false, scm: [
$class: 'GitSCM',
branches: [[name: '*/master']],
doGenerateSubmoduleConfigurations: false, 
extensions: [
   [
 $class: 'SparseCheckoutPaths', 
 sparseCheckoutPaths: [[path: '/my/path']]
   ]
], 
submoduleCfg: [], 
userRemoteConfigs: [[url: 'ssh://u...@domain.com:x/11346/myrepo.git']]]

El miércoles, 24 de mayo de 2017, 2:23:31 (UTC-5), Mark Allison escribió:
>
> Hi,
>
> I have a large repo in GitHub Enterprise and need to clone a sub-directory 
> from it on my Jenkins build server and just build that sub-directory. I am 
> using a pipeline script and have this right now:
>
> node {
> stage ('checkout') {
> git url: 'git@github.devops.mycompany.local:Org/MyLargeRepo.git'
> }
> }
>
> What I want is to clone from 
> github.devops.mycompany.local:Org/MyLargeRepo/path/to/subproject
>
> I know I probably need to use sparse and/or shallow checkouts, but can't 
> seem to work out how to configure that in a Jenkins pipeline script with 
> the git plugin. Any ideas?
>

-- 
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/de3a19e6-3679-430c-a5ab-8849b84f78bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to clone a directory from a remote repo in a Jenkins pipeline script?

2017-05-31 Thread Stephen Connolly
On Wed 31 May 2017 at 16:32, Mark Allison  wrote:

>
>>
>> On Wed, May 24, 2017 at 9:01 AM Mark Allison  wrote:
>>
>>> On Wednesday, 24 May 2017 13:29:58 UTC+1, Daniel Beck wrote:
>>>

 > On 24. May 2017, at 09:23, Mark Allison  wrote:
 >
 > I know I probably need to use sparse and/or shallow checkouts, but
 can't seem to work out how to configure that in a Jenkins pipeline script
 with the git plugin. Any ideas?

 Use the 'checkout' step and specify Git SCM. That should allow you to
 use all the options available in Git. Use the snippet generator for this.

 Daniel, how does that show checking out a directory within a repo? Do
>>> you have something more concrete? The snippet generator does not show this.
>>>
>>
>> Checking out to a subdirectory within a workspace requires that you nest
>> the checkout() step inside a dir("subdir-name") step.  The snippet
>> generator only shows one at a time (as far as I recall), so it won't show
>> you that combination.
>>
>> Refer to
>> https://github.com/MarkEWaite/jenkins-bugs/blob/JENKINS-43052/Jenkinsfile for
>> an example of that technique.
>>
>
> Hi Mark,
>
> I am trying to checkout FROM a remote subdirectory within a repo not to a
> subdirectory. Does anyone know how to do that with the git plugin?
>

Git doesn't really do that.

I'd probably see if there is a command from the CLI that does what you want
and then just use a `sh` step to do that

(I'm betting there is no such CLI command BTW)

-- 
> 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/c90805be-fae3-4f26-bc85-c9e8c1f45e29%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 
Sent from my phone

-- 
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/CA%2BnPnMycSfKNpTTTPNnNxF_xevZwb%3DEfRc7QMMspXB8gN_epLQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to clone a directory from a remote repo in a Jenkins pipeline script?

2017-05-31 Thread Mark Allison

>
>
>
> On Wed, May 24, 2017 at 9:01 AM Mark Allison  > wrote:
>
>> On Wednesday, 24 May 2017 13:29:58 UTC+1, Daniel Beck wrote:
>>
>>>
>>> > On 24. May 2017, at 09:23, Mark Allison  wrote: 
>>> > 
>>> > I know I probably need to use sparse and/or shallow checkouts, but 
>>> can't seem to work out how to configure that in a Jenkins pipeline script 
>>> with the git plugin. Any ideas? 
>>>
>>> Use the 'checkout' step and specify Git SCM. That should allow you to 
>>> use all the options available in Git. Use the snippet generator for this. 
>>>
>>> Daniel, how does that show checking out a directory within a repo? Do 
>> you have something more concrete? The snippet generator does not show this.
>>
>
> Checking out to a subdirectory within a workspace requires that you nest 
> the checkout() step inside a dir("subdir-name") step.  The snippet 
> generator only shows one at a time (as far as I recall), so it won't show 
> you that combination.
>
> Refer to 
> https://github.com/MarkEWaite/jenkins-bugs/blob/JENKINS-43052/Jenkinsfile for 
> an example of that technique.
>

Hi Mark,

I am trying to checkout FROM a remote subdirectory within a repo not to a 
subdirectory. Does anyone know how to do that with the git plugin?

-- 
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/c90805be-fae3-4f26-bc85-c9e8c1f45e29%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to clone a directory from a remote repo in a Jenkins pipeline script?

2017-05-24 Thread Mark Waite
On Wed, May 24, 2017 at 9:01 AM Mark Allison  wrote:

> On Wednesday, 24 May 2017 13:29:58 UTC+1, Daniel Beck wrote:
>
>>
>> > On 24. May 2017, at 09:23, Mark Allison  wrote:
>> >
>> > I know I probably need to use sparse and/or shallow checkouts, but
>> can't seem to work out how to configure that in a Jenkins pipeline script
>> with the git plugin. Any ideas?
>>
>> Use the 'checkout' step and specify Git SCM. That should allow you to use
>> all the options available in Git. Use the snippet generator for this.
>>
>> Daniel, how does that show checking out a directory within a repo? Do you
> have something more concrete? The snippet generator does not show this.
>

Checking out to a subdirectory within a workspace requires that you nest
the checkout() step inside a dir("subdir-name") step.  The snippet
generator only shows one at a time (as far as I recall), so it won't show
you that combination.

Refer to
https://github.com/MarkEWaite/jenkins-bugs/blob/JENKINS-43052/Jenkinsfile for
an example of that technique.

Mark Waite


>
>
> --
> 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/56b64b99-70dc-4e38-9a6a-6ba29e28aa1a%40googlegroups.com
> 
> .
> 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/CAO49JtFs%2B%3D9OuaLdjqX9w3Rbez3-DBN_yCFWEwLQ%2Bdz5dNUnyg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to clone a directory from a remote repo in a Jenkins pipeline script?

2017-05-24 Thread Mark Allison
On Wednesday, 24 May 2017 13:29:58 UTC+1, Daniel Beck wrote:
>
>
> > On 24. May 2017, at 09:23, Mark Allison  > wrote: 
> > 
> > I know I probably need to use sparse and/or shallow checkouts, but can't 
> seem to work out how to configure that in a Jenkins pipeline script with 
> the git plugin. Any ideas? 
>
> Use the 'checkout' step and specify Git SCM. That should allow you to use 
> all the options available in Git. Use the snippet generator for this. 
>
> Daniel, how does that show checking out a directory within a repo? Do you 
have something more concrete? The snippet generator does not show this. 

-- 
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/56b64b99-70dc-4e38-9a6a-6ba29e28aa1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to clone a directory from a remote repo in a Jenkins pipeline script?

2017-05-24 Thread Daniel Beck

> On 24. May 2017, at 09:23, Mark Allison  wrote:
> 
> I know I probably need to use sparse and/or shallow checkouts, but can't seem 
> to work out how to configure that in a Jenkins pipeline script with the git 
> plugin. Any ideas?

Use the 'checkout' step and specify Git SCM. That should allow you to use all 
the options available in Git. Use the snippet generator for this.

-- 
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/79BCCD51-3897-4695-BF9E-2E6AF9076CE4%40beckweb.net.
For more options, visit https://groups.google.com/d/optout.


How to clone a directory from a remote repo in a Jenkins pipeline script?

2017-05-24 Thread Mark Allison
Hi,

I have a large repo in GitHub Enterprise and need to clone a sub-directory 
from it on my Jenkins build server and just build that sub-directory. I am 
using a pipeline script and have this right now:

node {
stage ('checkout') {
git url: 'git@github.devops.mycompany.local:Org/MyLargeRepo.git'
}
}

What I want is to clone from 
github.devops.mycompany.local:Org/MyLargeRepo/path/to/subproject

I know I probably need to use sparse and/or shallow checkouts, but can't 
seem to work out how to configure that in a Jenkins pipeline script with 
the git plugin. Any ideas?

-- 
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/1800cb3e-750c-403a-8c5a-41ef6b7354b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.