Status: Resolved (View Workflow)
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.
You can call the git executable manually from the Jenkinsfile pipeline DSL, like this:
checkout scm bat 'git submodule update --init' // or sh
JENKINS-31924 GitSCMSource should offer extensions
This workaround does not always work. The scm credentials used to check out the repository are not available in the sh line so you can get an access denied.
Is there any way to execute the submodule command in the same context as the `checkout scm` is being run?
There is a solution for that using the approaches described in https://support.cloudbees.com/hc/en-us/articles/226122247-How-to-Customize-Checkout-for-Pipeline-Multibranch
Problem for us is that calling
seems to create the "impression" that another repo is used. We get the error
None or multiple repos
when we call "bitbucketStatusNotify(...)"
I ran into this problem today, submodules not being checked out, and the problem in my case was that I added the submodules to use ssh, but the multibranch pipeline uses https to do the git checkout. Once I updated my .gitmodules to use https urls it worked fine.
I think you would need to configure the SCM source to include the submodule extension.