Jenkins Pipeline: is it possible to avoid multiple checkout?

With plain git Jenkins has to do two checkouts: one to get the Jenkinsfile to know what to execute in the job, and then another checkout of the actual repository content for building purposes. Technically Jenkins only needs to load the one single Jenkinsfile from the repo, but git doesn't allow checkout of a single file. Therefore the double checkout cannot be avoided with plain git using the multibranch plugin.

If you host git on Bitbucket or GitHub then you avoid the double checkout by using their specific Jenkins plugins instead of the multibranch plugin.

See the Jenkins plugin site for Bitbucket and GitHub plugins accordingly.

These plugins use the respective Git provider's REST API to load the single Jenkins file. So you technically still have a double checkout, but the first one is a simple REST call to download a single file, rather than doing a full native git checkout of the whole repository.