Not sure you can put the if before the whole stage (I’m using scripted pipeline, not declared one du to limitation). but Having stage that appear or disappear make the GUI stage display do weird think into scripted pipeline for the job table. I often just skip the inner content of the steps and display a trace into the console to keep a trace the step was skipped, anyway the build time for that step will be nearly 0ms.
steps { if(gitBranch != ‘re-5.1’) { … do your step code here } } This way the job display may stay the same when skipping or not the steps. Might not be what you want, just throwing an idea here. From: jenkinsci-users@googlegroups.com <jenkinsci-users@googlegroups.com> On Behalf Of Sravya Kancherla Sent: November 23, 2020 2:58 AM To: jenkinsci-users@googlegroups.com Subject: Re: Pipeline with multiple Git repositories - how to checkout and Skip particular Repo Hi Join I have pipeline for multiple git repositories as shown below, i want to skip a stage stage (RM) { steps{ checkout([$class: 'GitSCM', branches: [[name: gitBranch]], extensions: [[$class: 'CloneOption', timeout: 120]], userRemoteConfigs: [[credentialsId: "${credentialsId}", url: mainProjectGITURL1 ] ]]) } } stage (RMC) { steps{ checkout([$class: 'GitSCM', branches: [[name: gitBranch]], extensions: [[$class: 'CloneOption', timeout: 120]], userRemoteConfigs: [[credentialsId: "${credentialsId}", url: mainProjectGITURL2 ] ]]) } } I want to skip stage RMC when branch is re-5.1 On Mon, Nov 23, 2020 at 7:50 AM john levin <smart.le...@gmail.com<mailto:smart.le...@gmail.com>> wrote: You should use git submodules to handle multiple repositories. Check the submodule documentation for more info. /John On Mon, 23 Nov, 2020, 2:15 am Sravya Kancherla, <kancherlasra...@gmail.com<mailto:kancherlasra...@gmail.com>> wrote: 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 <vane...@gmail.com<mailto:vane...@gmail.com>> 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 jenkinsci-use...@googlegroups.com<mailto:jenkinsci-use...@googlegroups.com>. 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 jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a3a16754-74b5-4022-88ea-eb9e0ac19555n%40googlegroups.com<https://groups.google.com/d/msgid/jenkinsci-users/a3a16754-74b5-4022-88ea-eb9e0ac19555n%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<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAGJXh7o_iovEq2jqrA2f3dW7ajtansTJ7iW%3D8CtmvpnLExxBCg%40mail.gmail.com<https://groups.google.com/d/msgid/jenkinsci-users/CAGJXh7o_iovEq2jqrA2f3dW7ajtansTJ7iW%3D8CtmvpnLExxBCg%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<mailto:jenkinsci-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CA%2BfgoYc%2Bky%3D7u%2BxCTSCyPZT1SL7Odg%3D%3DzZF3_a71OLibpDhY3w%40mail.gmail.com<https://groups.google.com/d/msgid/jenkinsci-users/CA%2BfgoYc%2Bky%3D7u%2BxCTSCyPZT1SL7Odg%3D%3DzZF3_a71OLibpDhY3w%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/QB1PR01MB38440F27A42539B3BF18B5C1CDFC0%40QB1PR01MB3844.CANPRD01.PROD.OUTLOOK.COM.