DEV Community

Kinga
Kinga

Posted on • Edited on

6 1

Azure DevOps pipelines shallow fetch =1 is now default

Pipeline doesn’t work? The old one, exactly the same, is working?
You came to the right place :)

UPDATE 2023.01.27: You may also set fetchDepth: 0 in your checkout step.

The team responsible for the documentation has been very fast, and they updated steps.checkout definition and Build Azure Repos Git or TFS Git repositories within two days from reporting this issue. If you come across any documentation articles that need this info, try reporting it =)

This may come as a surprise, and I imagine it will "break" many newly created pipelines.
All of a sudden things that used to work, won't.

Newly created Azure DevOps pipelines have shallow fetch enabled by default, and the depth is set to 1.

Image description

It's not documented, not even in what's new (although I asked for it to be mentioned so maybe by the time you are reading this, it's there).

You have two options now, if you want to change it.
Either fetchDepth in checkout step, or disable shallow fetch on the pipeline level.

Disable shallow fetch

  1. Navigate to your pipeline and click Edit Image description
  2. Click the ... button and choose Triggers Image description
  3. Switch to YAML tab and click on Get sources Image description
  4. Here it is, at the very bottom Image description

Reinvent your career. Join DEV.

It takes one minute and is worth it for your career.

Get started

Top comments (6)

Collapse
 
beatsunionsadra profile image
Sadra Abedinzadeh

Been dealing with this for a few days, and getting frustrated.
Thanks for the solution :)

Collapse
 
grigoriy0 profile image
Grigory Konoplich • Edited

If pipeline is writen in YAML, also you can use this:

steps:
  - checkout: self
    fetchDepth: 2
Enter fullscreen mode Exit fullscreen mode

just note here for people, who encounter with problems for searching documentation

Collapse
 
kkazala profile image
Kinga • Edited

Or fetchDepth: 0 not to limit depth at all, as suggested at the very top =)

Collapse
 
john_zabroski_bcabcf67e61 profile image
John Zabroski

I tried setting fetchDepth to 0 as described in your blog post and also documented here learn.microsoft.com/en-us/azure/de...

The outcome in my ADO build log is:

git --config-env=http.extraheader=env_var_http.extraheader fetch --force --tags --prune --prune-tags --progress --no-recurse-submodules origin --depth=1 +89e81380bdb7c3532e0ccc4f7b8f86bc864760cf:refs/remotes/origin/89e81380bdb7c3532e0ccc4f7b8f86bc864760cf

This is really frustrating. It's almost like Microsoft is actively trying to discourage useful uses of network bandwidth.

Collapse
 
hoangminh profile image
Hoang Minh

I am unable to make changes and save even though I'm a project admin and the pipeline creator....not sure why happens

Collapse
 
kkazala profile image
Kinga

Interesting... I just checked checked my existing pipeline, and created two new (Azure Repos Git and GitHub) and I was able to disable shallow fetch entirely. Saved successfully.
Dunno 🤷‍♀️

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay