Checkout submodules in Jenkins with Github organisation plugin Checkout submodules in Jenkins with Github organisation plugin jenkins jenkins

Checkout submodules in Jenkins with Github organisation plugin


The solution with sh 'git submodule...' works only for Repositorys without special authentication.

We use following solution in our set up:

node {    checkout([        $class: 'GitSCM',        branches: scm.branches,        doGenerateSubmoduleConfigurations: true,        extensions: scm.extensions + [[$class: 'SubmoduleOption', parentCredentials: true]],        userRemoteConfigs: scm.userRemoteConfigs    ])}


In the Github organization plugin, add the advanced submodule behaviors.

Org Setings Page

And configure it like this:

enter image description here


As @oeuftete pointed out, you also may need to add the "Checkout over SSH" behaviour (and provide a key credential) if the submodule(s) use the SSH protocol.

As documented here: https://wiki.jenkins.io/display/JENKINS/Git+Plugin


Change it to this:

node {    checkout scm    sh 'git submodule update --init'}

Use bat instead of sh if Jenkins is running on Windows.