Skip to content

[ISSUE]: Falsely detecting shallow clone - azure devops build with unshallow checkout failing #1379

@dazinator

Description

@dazinator

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

GitVersion package

GitVersion.Tool, AzureDevops task

GitVersion version

6.0.5

Operating system

Linux

What are you seeing?

In my azure-pipleines.yml

steps:
- checkout: self
  persistCredentials: true
  clean: true
  fetchDepth: 0 # fetch full history for versioning

- task: gitversion/[email protected]
  displayName: Install GitVersion
  inputs:
    versionSpec: '6.x'    

- task: gitversion/[email protected]
  displayName: Determine Version
  name: Version
  inputs:
    useConfigFile: true
    configFilePath: GitVersion.yml

The see the -unshallow option being used in checkout happening in the azure devops pipeline logs

Starting: Checkout HubCore@refs/pull/991/merge to s
==============================================================================
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
Syncing repository: HubCore (Git)
git version
git version 2.34.1
git config --get remote.origin.url
git clean -ffdx
git reset --hard HEAD
HEAD is now at 8603488f28 Merge pull request 991 from hotfix/0.88.7 into master
git config gc.auto 0
git config core.longpaths true
git config --get-all http.https://***@dev.azure.com/***/***/_git/HubCore.extraheader
git config --get-all http.extraheader
git config --get-regexp .*extraheader
git config --get-all http.proxy
git config http.version HTTP/1.1
git --config-env=http.extraheader=env_var_http.extraheader fetch --force --tags --prune --prune-tags --progress --no-recurse-submodules origin --unshallow  +refs/heads/*:refs/remotes/origin/* +refs/pull/991/merge:refs/remotes/pull/991/merge
remote: Azure Repos        
remote: 
remote: Found 63848 objects to send. (1560 ms)        
Receiving objects:   0% (1/63848)
Receiving objects:   1% (639/63848)
Receiving objects:   2% (1277/63848)
Receiving objects:   3% (1916/63848)
// shortened for brevity

The install step succeeds

Starting: Install GitVersion
==============================================================================
Task         : Setup GitVersion Task
Description  : Easy Semantic Versioning (https://semver.org/) for projects using Git
Version      : 3.0.3
Author       : GitTools Contributors
Help         : See the [documentation](https://gitversion.net/docs/) for help
==============================================================================
Running on: 'Azure Pipelines'
Disable Telemetry
--------------------------
Acquiring GitVersion.Tool for version spec: 6.x
--------------------------
Querying tool versions for [email protected] 
Found matching version: 6.0.5
Looking for local tool [email protected]
Found tool [email protected] at /azp/_work/_tool/GitVersion.Tool/6.0.5
--------------------------
GitVersion.Tool version: 6.0.5 found in local cache at /azp/_work/_tool/GitVersion.Tool/6.0.5.
--------------------------
Prepending /azp/_work/_tool/GitVersion.Tool/6.0.5 to PATH
Updated PATH: /azp/_work/_tool/GitVersion.Tool/6.0.5:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Set GITVERSION_PATH to /azp/_work/_tool/GitVersion.Tool/6.0.5
GitVersion installed successfully
Finishing: Install GitVersion

However then the execute step fails

Starting: Determine Version
==============================================================================
Task         : Execute GitVersion Task
Description  : Easy Semantic Versioning (https://semver.org/) for projects using Git
Version      : 3.0.3
Author       : GitTools Contributors
Help         : See the [documentation](https://gitversion.net/docs/) for help
==============================================================================
Running on: 'Azure Pipelines'
Disable Telemetry
Executing GitVersion
Command: git -C /azp/_work/1/s rev-parse --is-shallow-repository
##[error]The repository is shallow. Consider disabling shallow clones. See https://github.com/GitTools/actions/blob/main/docs/cloning.md for more information.
Finishing: Determine Version

I am very confused.. looking for inspiration or ideas?

What is expected?

I didn't expect it to report a shallow clone with the checkout step fetch depth set to 0.

Steps to Reproduce

as per above is my current setup. Not sure how reproducable.

RepositoryFixture Test

No response

Output log or link to your CI build (if appropriate).

as per above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions