2021年7月29日 星期四

Implicitly loading submodules in Jenkins pipeline stages

I assume you have been using the git step so far to clone a repository.

However for advanced features (like submodules) there's the checkout step available: https://jenkins.io/doc/pipeline/steps/workflow-scm-step/

The checkout steps provides an option to update all submodules and can even update the submodules recursively, e.g.:

checkout([$class: 'GitSCM',
    branches: [[name: '*/master']],
    doGenerateSubmoduleConfigurations: false,
    extensions: [[$class: 'SubmoduleOption',
        disableSubmodules: false,
        parentCredentials: false,
        recursiveSubmodules: false,
        reference: '',
        trackingSubmodules: false
    ]],
    submoduleCfg: [],
    userRemoteConfigs: [[url: 'ssh://myserver/myrepo']]
])

What actually enables cloning of the submodules is the SubmoduleOption extension as seen in the example above.

As the syntax is - let's say - little bit more complex I recommend using the snipped generator. 


from: https://stackoverflow.com/questions/51361907/implicitly-loading-submodules-in-jenkins-pipeline-stages

沒有留言:

張貼留言