-
Improvement
-
Resolution: Unresolved
-
Minor
-
-
Declarative backlog
Right now it's very hard to use a declarative pipeline if you need to customize how the Git checkout is done, specially when combined with dockerized builds.
The only approach I could find currently is to do something like:
pipeline { // If docker is used here, the image needs to have Git installed agent any stages { stage("Checkout") { steps { checkout([ $class: 'GitSCM', branches: scm.branches, extensions: scm.extensions + [[$class: 'CleanCheckout']], userRemoteConfigs: scm.userRemoteConfigs ]) } } stage("Another") { agent { docker { // This is needed so the previous checkout is used reuseNode true } } // ... } } }
And then I have to copy the docker agent to all subsequent stages, which for very long and complex pipelines and specially ones using a lot of docker options, is super annoying and error prone. Also, the `checkout()` call needs some special permissions one need to approve in jenkins first, when all I want is to use some extension.
So, doing this is very complex and error prone. Because of this, it would be nice (and make sense) if there is any way to customize the initial checkout instead of having to make it as a stage.
Something like:
pipeline {
options {
checkoutExtensions ['CleanCheckout']
}
}
Or maybe being able to just call `checkout()` in options, but if that means needing special permissions, it would also be not ideal.
- is duplicated by
-
JENKINS-53473 Support implicit checkout behavior override
-
- Fixed but Unreleased
-
- links to
BTW, the permissions part is mentioned here: https://support.cloudbees.com/hc/en-us/articles/226122247-How-to-Customize-Checkout-for-Pipeline-Multibranch-