Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 588
Marko Avatar asked Aug 07 '26 18:08

Marko


2 Answers

When a pipeline is queued the ref is set. All jobs in the pipeline will checkout that reference. It's one of the reasons why the agent checks out the ref specifically and leaves the repo in detached HEAD state.

I can't find a doc that explicitly explains this, but that's how it works.

like image 110
jessehouwing Avatar answered Aug 09 '26 13:08

jessehouwing


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
. . .
like image 44
Bright Ran-MSFT Avatar answered Aug 09 '26 12:08

Bright Ran-MSFT



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!