I do not want to use checkout scm, that's the reason why I ask.
I want to checkout multiple repositories in the jenkinsfile and make sure that the workspace is clean (git clean)
For checkout scm there's a checkbox to do exactly that. How can I reproduce this for the git checkout function in groovy? All i've found regarding this topic is to call git clean -fdxvia 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
}
Something like described here: 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
[...]
}
but not for checkout but for the git function. (see the example above)