fab*_*iim 12 git groovy git-submodules jenkins jenkins-pipeline
我有一个由Github组织插件创建的Jenkins构建工作.在Jenkinsfile此构建检出使用的代码checkout scm,这是很好,因为它无论是建设PR引起的变化或推到主分支时,计算出正确的分支/修订结帐.
我怎么能这样做:
node {
checkout scm
}
Run Code Online (Sandbox Code Playgroud)
结帐子模块?
小智 18
该解决方案sh 'git submodule...'仅适用于没有特殊身份验证的Repositorys.
我们在设置中使用以下解决方案:
node {
checkout([
$class: 'GitSCM',
branches: scm.branches,
doGenerateSubmoduleConfigurations: true,
extensions: scm.extensions + [[$class: 'SubmoduleOption', parentCredentials: true]],
userRemoteConfigs: scm.userRemoteConfigs
])
}
Run Code Online (Sandbox Code Playgroud)
Oha*_*had 12
在Github组织插件中,添加高级子模块行为。
并像这样配置它:
正如@oeuftete指出的,如果子模块使用SSH协议,您可能还需要添加“通过SSH签出”行为(并提供密钥证书)。
如此处所述:https : //wiki.jenkins.io/display/JENKINS/Git+Plugin
改成这样:
node {
checkout scm
sh 'git submodule update --init'
}
Run Code Online (Sandbox Code Playgroud)
如果 Jenkins 在 Windows 上运行,则使用bat代替。sh
| 归档时间: |
|
| 查看次数: |
15156 次 |
| 最近记录: |