Interview Prep/Jenkins/Declarative pipeline syntax

What does `skipDefaultCheckout` do, and when do you need it?

IntermediateConceptDeclarative pipeline syntax
Answer

By default a declarative pipeline from SCM checks out the repo automatically when an agent is allocated (at pipeline level and in each stage with its own agent). options { skipDefaultCheckout() } disables that. Use it when stages do not need the source (deploy pods, notification stages), when you need custom checkout options (shallow clone, sparse checkout, submodules), or to avoid repeated clones of a large repo.

checkout scmGit(branches: [[name: env.BRANCH_NAME]], extensions: [cloneOption(shallow: true, depth: 1, noTags: true)], userRemoteConfigs: scm.userRemoteConfigs)
All Jenkins questions Roadmap: Jenkins

More on Declarative pipeline syntax