Hi,

I have Pipeline for multiple Git repositories to checkout and i want to 
skip one repo at particular branch

eg: repo1,repo2,repo3,repo4.....

i want to skip repo3 when branch is re-5.1 
On Tuesday, May 28, 2019 at 5:53:09 PM UTC+5:30 Mark Waite wrote:

>
>
> Git takes full control of the directory for each checkout.  Thus, the last 
> checkout "wins" by containing the content of only that checkout.
>
> Perform a checkout command for each repository in a separate directory.  
> Create the directory for each checkout with the dir() step or the ws() 
> step, and place the checkout inside the block from that step.  Something 
> like this:
>
> dir('dir-1-for-repo-1') {
>   checkout([$class: 'GitSCM', branches: [[name: gitBranch]], extensions: 
> [[$class: 'CloneOption', timeout: 120]], 
>           userRemoteConfigs: [[credentialsId: "${credentialsId}", url: 
> mainProjectGITURL ]  ]])
> }
> dir('dir-2-for-repo-2') {
>   checkout([$class: 'GitSCM', branches: [[name: gitBranch]], extensions: 
> [[$class: 'CloneOption', timeout: 120]], 
>           userRemoteConfigs: [[credentialsId: "${credentialsId}", url:  
> list[0] ]  ]])
> }
>
> On Tue, May 28, 2019 at 4:14 AM Jacques van der Merwe <[email protected]> 
> wrote:
>
>> I know this is fairly old thread but I have an issue
>> when using the multi repo checkout it seems to remove the previous repo 
>> checkout before doing the new one. 
>> I have tried checking all the repos required for my build using the 
>> Jenkins Declarative "checkout" command
>> checkout([$class: 'GitSCM', branches: [[name: "${gitBranch}"]], 
>> doGenerateSubmoduleConfigurations: false, extensions: [[$class: 
>> 'CloneOption', timeout: 120]], submoduleCfg: [], userRemoteConfigs: [
>>      [credentialsId: "${credentialsId}", url: "${mainProjectGITURL}"],
>>      [credentialsId: "${credentialsId}", url: "${list[0]}"],
>>      [credentialsId: "${credentialsId}", url: "${list[1]}"],
>>      [credentialsId: "${credentialsId}", url: "${list[2]}"],
>>      [credentialsId: "${credentialsId}", url: "${list[3]}"]
>>      ]])
>> With this config I can see on my build server each project are being 
>> checked out but only the last project is availbale after this checkout.
>>
>>
> Multiple userRemoteConfigs in a single checkout command will perform a 
> single checkout of one of the remote configs.  It won't iterate over the 
> list of remote configs and definitely won't create the separate 
> subdirectories that would be needed to retain a checkout of multiple 
> repositories.
>
> Multiple userRemoteConfigs in a single checkout are allowed as a 
> historical use that was allowed for those rare cases where multiple 
> locations contained the same repository and any one of the repositories 
> could be used.  Multiple userRemoteConfigs won't help in this case and they 
> don't help in almost all cases.
>  
>
>> I also tried doing in a loop using "git" only
>>    def list = "${includedProjectsGITURLS}".split("\n")
>>     echo "Number of repos : " + list.size()
>>     echo "Checking out main project (${gitBranch}) :  " + 
>> mainProjectGITURL + "\n";
>>     git credentialsId: 'blablabla', url: "${mainProjectGITURL}"
>>     for (String gitSubURL:list)
>>  {
>>     echo "Checking out sub project (${gitBranch}) :  " + gitSubURL + "\n";
>>         git credentialsId: 'blablabla', url: "${gitSubURL}"
>>  }
>> The result is the same, making me think "checkout" is just wrapper for GIT
>>
>>
> The git step is a simplified form of the checkout step.  If your case does 
> not need the full capability of the checkout step, you are welcome to use 
> the git step.  I find that I almost always want the checkout step because 
> it allows me to control things more precisely.
>  
>
>> I also tried checking each repo into its own sub folder but the result is 
>> the same
>>
>>
> We'll need more explanation of what was tried in this case, since that is 
> the technique that works for many users.
>
> Thanks,
> Mark Waite
>  
>
>> any ideas how I can checkout multiple repos in Jenkins declarative script 
>> for single build
>>
>>
>>
>> On Wednesday, December 21, 2016 at 7:25:43 PM UTC+2, Torsten Reinhard 
>> wrote:
>>>
>>> Hi, 
>>>
>>> I have a pipeline doing a build and afterwards a deployment to the TEST 
>>> environment.
>>>
>>> For the build I need to 
>>> // checkout sources for building
>>> checkout scm
>>>
>>> and later on I need to 
>>> //checkout configuration for TEST environment
>>> checkout scm (config)
>>>
>>> I wasn´t able to configure a working directory for each repo - and the 
>>> "Multiple SCMs plugin" is deprecated with a hint to the Pipeline plugin.
>>> How can I setup the Pipeline job so it´s using "Pipeline script from 
>>> SCM" AND additionally some files/configs from a different repo?
>>>
>>> I know about the workaround with subtrees and also this issue: 
>>> https://issues.jenkins-ci.org/browse/JENKINS-13228, 
>>> but I´m wondering why help points to the Pipeline plugin ? 
>>>
>>> Any sample setup available ?
>>>
>>> Thanx for helping, 
>>>
>>> Torsten
>>>
>>> -- 
>> 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 [email protected].
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/0d41e558-853d-4cbc-8b8f-fbcdfffedb57%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/0d41e558-853d-4cbc-8b8f-fbcdfffedb57%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>
>
>> 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 Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/a3a16754-74b5-4022-88ea-eb9e0ac19555n%40googlegroups.com.

Reply via email to