Jenkins pipeline git command submodule update

前端 未结 3 1548
甜味超标
甜味超标 2020-12-08 02:31

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         


        
3条回答
  •  無奈伤痛
    2020-12-08 03:16

    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 !

提交回复
热议问题