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

Multibranch pipeline 'checkout scm' does not handle Git submodules

      When using a Multibranch Pipeline job type, the Jenkinsfile in the SCM repository branch being built contains the statement checkout scm. But if the Git repository contains submodules, they are not initialized or updated in the Jenkins build workspace.

      Typically submodule initialization/updating is automatically handled by the Git SCM for Jenkins Freestyle jobs.

      Workaround

      You can call the git executable manually from the Jenkinsfile pipeline DSL, like this:

              checkout scm
              bat 'git submodule update --init'     // or sh
      

          [JENKINS-32658] Multibranch pipeline 'checkout scm' does not handle Git submodules

          Colin Bennett created issue -
          Colin Bennett made changes -
          Description Original: When using a Multibranch Pipeline job type, the Jenkinsfile in the SCM repository branch being built contains the statement {{checkout scm}}. But if the Git repository contains submodules, they are not initialized or updated in the Jenkins build workspace.

          Typically submodule initialization/updating is automatically handled by the Git SCM for Jenkins Freestyle jobs.

          h4. Workaround
          You can call the {{git}} executable manually from the Jenkinsfile pipeline DSL, like this:
          {noformat}
                  checkout scm
                  execute 'git submodule update --init'
          {noformat}
          New: When using a Multibranch Pipeline job type, the Jenkinsfile in the SCM repository branch being built contains the statement {{checkout scm}}. But if the Git repository contains submodules, they are not initialized or updated in the Jenkins build workspace.

          Typically submodule initialization/updating is automatically handled by the Git SCM for Jenkins Freestyle jobs.

          h4. Workaround
          You can call the {{git}} executable manually from the Jenkinsfile pipeline DSL, like this:
          {noformat}
                  checkout scm
                  bat 'git submodule update --init' // or sh
          {noformat}
          Colin Bennett made changes -
          Issue Type Original: Bug [ 1 ] New: Improvement [ 4 ]
          Jesse Glick made changes -
          Link New: This issue duplicates JENKINS-31924 [ JENKINS-31924 ]

          Jesse Glick added a comment -

          I think you would need to configure the SCM source to include the submodule extension.

          Jesse Glick added a comment - I think you would need to configure the SCM source to include the submodule extension.
          Jesse Glick made changes -
          Resolution New: Duplicate [ 3 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 168317 ] New: JNJira + In-Review [ 198396 ]
          Stan Domula made changes -
          Comment [ [~jglick] how to set the extension config on scm? There is no function in GitSCM class to set the extensions except with the constructor. I can create a custom checkout(...) call. but than it makes no sense in a multibranch project with Jenkinsfiles.

          ]
          Andrew Bayer made changes -
          Component/s New: pipeline-general [ 21692 ]
          Andrew Bayer made changes -
          Component/s Original: workflow-plugin [ 18820 ]

            Unassigned Unassigned
            cbennett Colin Bennett
            Votes:
            0 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: