Jenkins 结帐管道步骤中是否允许 "extensions" 的多个值?
Are multiple values for "extensions" allowed in Jenkins checkout pipeline step?
参考 workflow scm step 中的“扩展”属性,它被声明为具有“嵌套对象选择”的 Array/List。
我想做类似以下的事情:
checkout(
[
$class: 'GitSCM',
extensions: [
[$class: 'CloneOption', timeout: 15],
[$class: 'AuthorInChangelog']
],
...
]
)
checkout.extensions
真的是 Arrays/Lists 的 Array/List 吗?
是的,您可以指定多个扩展名,下面是一个适合我的示例
checkout changelog: changelog, poll: true, scm: [
$class: 'GitSCM',
branches: [[name: "${branchName}"]],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'CloneOption', timeout: 60],
[$class: 'SubmoduleOption', recursiveSubmodules: true, parentCredentials: true, timeout: 60],
[$class: 'PruneStaleBranch']],
submoduleCfg: [],
userRemoteConfigs: [[name: 'origin', url: "${env.GITLAB_SSH}/${projectName}.git", credentialsId: 'jenkins']]
]
参考 workflow scm step 中的“扩展”属性,它被声明为具有“嵌套对象选择”的 Array/List。
我想做类似以下的事情:
checkout(
[
$class: 'GitSCM',
extensions: [
[$class: 'CloneOption', timeout: 15],
[$class: 'AuthorInChangelog']
],
...
]
)
checkout.extensions
真的是 Arrays/Lists 的 Array/List 吗?
是的,您可以指定多个扩展名,下面是一个适合我的示例
checkout changelog: changelog, poll: true, scm: [
$class: 'GitSCM',
branches: [[name: "${branchName}"]],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'CloneOption', timeout: 60],
[$class: 'SubmoduleOption', recursiveSubmodules: true, parentCredentials: true, timeout: 60],
[$class: 'PruneStaleBranch']],
submoduleCfg: [],
userRemoteConfigs: [[name: 'origin', url: "${env.GITLAB_SSH}/${projectName}.git", credentialsId: 'jenkins']]
]