Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] Azure Devops - Fetch Depth #3612

Closed
dazinator opened this issue Jun 27, 2023 · 8 comments
Closed

[Docs] Azure Devops - Fetch Depth #3612

dazinator opened this issue Jun 27, 2023 · 8 comments

Comments

@dazinator
Copy link
Member

dazinator commented Jun 27, 2023

For Azure devops build pipelines created later than a certain date, they started doing shallow clone's and subsequently this means the following gitversion AzDO tasks fail.

   - task: gitversion/setup@0
      displayName: Install GitVersion
      inputs:
        versionSpec: '5.11.1'

    - task: gitversion/execute@0
      displayName: Determine Version
      inputs:      

There is a gitversion docs page for configuring the different build servers but nothing about this for azure devops that I could see.

The important piece of info is here: https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/steps-checkout?view=azure-pipelines#shallow-fetch

image

It basically boils down to this, you need to add an intial checkout task to your yaml pipeline to control checkout behaviour and explicit set fetch depth to 0 (which means it won't do shallow fetch).

 steps:     
    # this is rewquired for gitversion
    - checkout: self
      fetchDepth: 0
      clean: true 
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs.

@github-actions github-actions bot added the stale label Sep 26, 2023
@github-actions
Copy link

This issue was closed because it has been stalled for 30 days with no activity. Thank you for your contributions

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 27, 2023
@asbjornu asbjornu removed the stale label Oct 27, 2023
@asbjornu asbjornu reopened this Oct 27, 2023
@asbjornu
Copy link
Member

A pull request documenting this would be merged in an instant. 🙏🏼

@arturcic
Copy link
Member

I think The AzureDevops task should point instead to https://github.com/GitTools/actions/tree/main/docs/examples/azure as there we have the examples and docs

@HHobeck HHobeck modified the milestones: 6.x, 7.x Jan 4, 2024
@arturcic
Copy link
Member

arturcic commented Mar 9, 2024

Closing in favor of #3937

@arturcic arturcic closed this as completed Mar 9, 2024
@arturcic arturcic removed this from the 7.x milestone Mar 9, 2024
@mc0re
Copy link

mc0re commented Jul 8, 2024

I get this problem even with fetchDepth: 0 setting. The problem occurs every time I start a pipeline run. When I re-run the job (Re-run failed tasks), it goes well.

    steps:
    - checkout: self
      clean: true
      fetchDepth: 0
      fetchTags: true
      submodules: recursive

@jzabroski
Copy link

I also have this problem @mc0re - did you find a solution? It seems like every couple of years, Microsoft VSTS/AzureDevOps finds a way to break this feature. It broke in 2018 and 2022, and now 2024.

@mc0re
Copy link

mc0re commented Aug 7, 2024

@jzabroski In my case the issue was in using on-site agents and not cleaning them. There's a file in .git directory that tells Git it's working in shallow mode. The file is created by later jobs, using shallow checkout. Delete it after the checkout step - and it works.
I'm afraid I can't recall the exact name of the file and I cannot look it up now, but it was obvious from the name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants