Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-53473

Support implicit checkout behavior override

XMLWordPrintable

      The implicit checkout behavior is great when you have a single source repo and you're using the standard checkout options. But when you have multiple repos or you want advanced options you have to manually use the checkout() step with your options.

       

      This gets cumbersome when you have multiple stages on multiple agents in parallel.

       

      What would be nice is if I could provide a function to override the implicit checkout behavior, so that anytime an agent is entered my function was called and setup up my source code in the way that I wanted, without having to provide these steps on every single agent step.

       

       

      def myCheckout() {
        dir("prj1") {
           checkout([$class: "GitSCM",
              url: "prj1.git"
           ])
        }
       dir("prj2") {
         checkout([$class: "GitSCM",
             url: "prj2.git"
         ])
       }
      }
      pipeline {
        agent none
        overrideDefaultCheckout myCheckout
      
        stage("Build") {
          agent {    // myCheckout should be called at this point
            label "linux"
          }
          steps {
            sh "cd prj1 && make all"
            sh "cd prj2 && make all"
          }
        }
      }

       

       

            Unassigned Unassigned
            kaibutsux Sean Grider
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: