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

Upgrading from 1.17.0 to 1.17.1 fails git fetch #93

Open
Larain opened this issue Feb 13, 2023 · 4 comments
Open

Upgrading from 1.17.0 to 1.17.1 fails git fetch #93

Larain opened this issue Feb 13, 2023 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@Larain
Copy link

Larain commented Feb 13, 2023

Hi,

We are using versionize tool in our GitLab CI/CD steps like this:

versioning:
  stage: release
  variables:
    # Force a deep/non-shallow fetch
    GIT_STRATEGY: fetch
    GIT_DEPTH: 0
  image: mcr.microsoft.com/dotnet/sdk:6.0-alpine
  script:
    - echo 'export PATH="$PATH:/root/.dotnet/tools"' >> ~/.bash_profile
    - source ~/.bash_profile
    - dotnet tool install --global Versionize --version 1.17.0
    - versionize

and after upgrading to from 1.17.0 to 1.17.1 we receiving an error

Error: LibGit2Sharp.NotFoundException
This is most likely caused by running versionize against a git repository cloned with depth --1.
In case you're using the actions/checkout@v2 in github actions you could specify fetch-depth: '1'.
For more detail see  https://github.com/actions/checkout
Exception detail:
LibGit2Sharp.NotFoundException: object not found - no match for id (ff1a6a984a775d514190534b8ffe0e9f0dbf1641)
   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) in /_/LibGit2Sharp/Core/Ensure.cs:line 154
   at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result) in /_/LibGit2Sharp/Core/Ensure.cs:line 172
   at LibGit2Sharp.Core.Proxy.git_revwalk_next(RevWalkerHandle walker) in /_/LibGit2Sharp/Core/Proxy.cs:line 2770
   at LibGit2Sharp.CommitLog.CommitEnumerator.MoveNext() in /_/LibGit2Sharp/CommitLog.cs:line 140
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Versionize.RespositoryExtensions.GetCommitsSinceLastVersion(Repository repository, Tag versionTag) in /home/runner/work/versionize/versionize/Versionize/RepositoryExtensions.cs:line 50
   at Versionize.WorkingCopy.Versionize(VersionizeOptions options) in /home/runner/work/versionize/versionize/Versionize/WorkingCopy.cs:line [46](https://gitlab.dev.clover.tech/iqsoft/coreplatform/-/jobs/364530#L46)
   at Versionize.Program.<>c__DisplayClass0_0.<Main>b__1() in /home/runner/work/versionize/versionize/Versionize/Program.cs:line 72
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass143_0.<OnExecute>b__0(CancellationToken _)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Versionize.Program.Main(String[] args) in /home/runner/work/versionize/versionize/Versionize/Program.cs:line 81

I tried to change GIT_STRATEGY to clone, adding --unshallow flag, and setting GIT_DEPTH: to 0 / 1 / 10000 (max depth of our repo) and nothing helped.

Could you assist please, is it a bug or something fundamentally changed that we need to reconfigure the CI/CD steps now?

@Larain Larain changed the title Upgrading from 1.17.0 to 1.17.1 fails step Upgrading from 1.17.0 to 1.17.1 git fetch Feb 13, 2023
@Larain Larain changed the title Upgrading from 1.17.0 to 1.17.1 git fetch Upgrading from 1.17.0 to 1.17.1 fails git fetch Feb 13, 2023
@cabauman
Copy link
Contributor

cabauman commented Feb 13, 2023

GitLab doesn't seem to be related since you said it works with the previous version, but I'll ask anyways: so, you use GitLab configuration like specified here?

GIT_STRATEGY: fetch
GIT_FETCH_EXTRA_FLAGS: --unshallow
GIT_DEPTH: 0

There's only a one commit (one file) difference between the two versions which is related to working directory. Does anything stand out? I'll see if I can reproduce the issue with GitHub when I get some time.

@swarooprooney
Copy link

was this resolved? I am facing the same issue with azure devops pipeline with github actions

@cabauman cabauman added the help wanted Extra attention is needed label Sep 16, 2023
@mumby0168
Copy link
Contributor

This was mentioned in #42

Setting the git fetch depth to 0 has just worked for my pipeline in ado:

stages:
- stage: conventionalcommit
  displayName: conventional commit
  jobs:
  - job: conventionalcommit
    pool:
      vmImage: "ubuntu-latest"
    steps:
      - checkout: self
        fetchDepth: 0
        persistCredentials: "true"

cc @swarooprooney

@jsyrjala
Copy link

For me this in worked in GitLab

variables:
    GIT_STRATEGY: fetch
    GIT_DEPTH: 1000

Having this parameter there caused some error about depth and unshallow not being compatible.

GIT_FETCH_EXTRA_FLAGS: --unshallow

GitLab has default git depth of 20 or 50:
https://microfluidics.utoronto.ca/gitlab/help/ci/pipelines/settings.md#limit-the-number-of-changes-fetched-during-clone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants