I want to update submodule on git clone.
Is there a way to do this with Jenkins pipeline Git command?
Currently I\'m doing this...
git branch
The git command as a pipeline step is rather limited as it provides a default implementation of the more complex checkout command. For more advanced configuration, you should use checkout command, for which you can pass a whole lot of parameters, including the desired submodules configuration.
What you want to use is probably something like this :
checkout([$class: 'GitSCM',
branches: [[name: '*/master']],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'SubmoduleOption',
disableSubmodules: false,
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]],
submoduleCfg: [],
userRemoteConfigs: [[url: 'your-git-server/your-git-repository']]])
From the documentation it is often cumbersome to write these kind of lines, I recommand you use instead Jenkins very good Snippet Generator
(YourJenkins > yourProject > PipelineSyntax) to automatically generate the checkout line !