![](/img/trans.png)
[英]Escape special character of git password in Jenkins pipeline groovy script
[英]Is there a proper way to call git clean in jenkins pipeline groovy script?
我不想使用checkout scm
,这就是我问的原因。 我想检查 jenkinsfile 中的多个存储库并确保工作区是干净的(git clean)
对于checkout scm
,有一个复选框可以做到这一点。 如何在 groovy 中为 git 结帐 function 重现此问题? All i've found regarding this topic is to call git clean -fdx
via shell call, but I'd prefer a clean solution in groovy over a shell call, if that's possible.
def checkoutGit(def cred,def repo, def branch)
{
git credentialsId: cred, url: repo, branch: branch
}
类似于此处描述的内容: https://support.cloudbees.com/hc/en-us/articles/226122247-How-to-customize-Checkout-for-Pipeline-Multibranch
node {
checkout([
$class: 'GitSCM',
branches: scm.branches,
extensions: scm.extensions + [[$class: 'CleanCheckout']],
userRemoteConfigs: scm.userRemoteConfigs
])
//Build, Test, Stage, Deploy
[...]
}
但不是用于结帐,而是用于 git function。 (见上面的例子)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.