我想在Git克隆上更新子模块。
有没有办法用jenkins pipeline git命令来完成这个操作?
目前我正在做这个…
git branch: 'master',
credentialsId: 'bitbucket',
url: 'ssh://bitbucket.org/hello.git'
但是,一旦克隆,它就不会更新子模块。
作为管道步骤的git命令非常有限,因为它提供了更复杂的checkout命令的默认实现。对于更高级的配置,您应该使用checkout命令,为此您可以传递大量参数,包括所需的子模块配置。
您想要使用的可能是这样的:
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']]])
从文档来看,编写这些行通常比较麻烦,我建议您使用