![](/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.