'Multi job pipeline always checks out same commit?

I have defined a multi job azure pipeline where every job needs to clone and checkout the source git repository. Some of these jobs can take a while so I am wondering if every job always clones and checks out the momentary HEAD version/commit of the Git branch or the pipeline trigger commit is remembered by the pipeline and then used for every job in order to have a consistent pipeline run.

I am pretty sure resp. can only hope the 2nd to be the case (and never saw anything else) but I am wondering if someone can point me to some Azure docs that officially confirm it.



Solution 1:[1]

In a build pipeline (both YAML and Classic), by default each job in the pipeline will check out the commit version which triggered the current pipeline run.

In YAML pipeline, if you do not want a job to check out the commit ref, you can add the following step as the first one in the job.

steps:
- checkout: none
. . .

Solution 2:[2]

Both @Jesse and @Bright are right

There's a pipeline decorator that is evaluated on the first stage that looks for the presence of the checkout task. If the task is not found, it is dynamically inserted as the first step in the job.

You can see the pipeline decorator if you look at the top-level logs of the stage and expand the Job preparation parameters:

system-pre-steps.yml

By specifying the checkout task with different settings, you can prevent this task from being injected:

steps:
- checkout: none

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Bright Ran-MSFT
Solution 2 bryanbcook