What does `checkout scm` actually check out in a multibranch job?
AdvancedConceptMultibranch, organization folders & webhooks
Answer
scm is the SCM object for the exact revision that triggered the build, as resolved during indexing. For a branch, it is the branch head commit; for a PR with merge strategy, Jenkins fetches the PR head and merges it with the target branch locally. This guarantees the build uses the same revision whose Jenkinsfile was loaded, even if new commits arrive meanwhile.
More on Multibranch, organization folders & webhooks
How does a multibranch pipeline work?BeginnerWhat is branch indexing and what triggers it?BeginnerWhat are the discovery traits in the GitHub branch source?IntermediateWhat does the fork PR trust setting protect against?AdvancedWhat environment variables are set for PR builds?BeginnerWhat is an organization folder?Intermediate