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

[ISSUE]: GitVersion sometimes takes several hours, seemingly hanging for several minutes between steps #4418

Open
2 tasks done
ChristoWolf opened this issue Feb 13, 2025 · 0 comments

Comments

@ChristoWolf
Copy link

ChristoWolf commented Feb 13, 2025

Prerequisites

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

GitVersion package

GitVersion.Tool

GitVersion version

6.1.0, something similar but faster (takes about 25 minutes) happens with 5.12.0

Operating system

Windows

What are you seeing?

Hi!

I am executing .\dotnet-gitversion /updateprojectfiles /output json /l console /diag /verbosity Diagnostic /nocache /nofetch on a repository with about 400 branches and 85 tags, containing C# code with about 400 projects.

I already had issues with GitVersion performance when using v5.12.0 where the above execution took about 25 minutes.
That got me thinking that it might have been related to #2881, so I updated to v6.1.0.
Executing the above command using that version either of these might happen:

  • Either everything works and GitVersion takes about a minute:
    • it takes about 10 seconds for Normalizing git directory for branch
    • Fetching the base versions for version calculation takes about 2 seconds and that specific log output is 33 lines long
    • Using continuous delivery workflow to calculate the incremented version takes 1 second
  • or the issue occurs where in between various steps execution takes several minutes without any log output. The log at the bottom shows this (abbreviations with ...). Execution then takes several hours in total. The log output in Fetching the base versions for version calculation grows to over 6000 lines until the task times out.

So I see 2 issues here:

  • Execution of some steps in GitVersion sometimes takes several minutes for no obvious reason,
  • and there are a lot more lines related to Finding merge base, Getting tagged semantic versions on branch and Found commit then when it runs fast.

I am only able to reproduce this when running GitVersion in a self-hosted Azure DevOps Server agent, not when running it on my machine.

Also, I checked #4409 but I am not sure if this is related.

Here is my GitVersion.yml:

mode: ContinuousDeployment
update-build-number: false
next-version: 0.17.1
assembly-versioning-format: "{Major}.{Minor}.{Patch}"
assembly-file-versioning-format: "{Major}.{Minor}.{Patch}"
assembly-informational-format: "{Major}.{Minor}.{Patch}{PreReleaseTagWithDash}+{env:BUILD_BUILDID ?? 0}"
branches:
  main:
    regex: ^master$|^main$
    is-source-branch-for: ["develop", "release"]
    is-main-branch: true
    label: ""
  develop:
    regex: ^develop$
    mode: ContinuousDeployment
    increment: None
    prevent-increment:
      of-merged-branch: false
    track-merge-target: true
    source-branches: ["main"]
    is-source-branch-for: ["feature"]
    tracks-release-branches: true
    is-release-branch: false
    is-main-branch: false
    pre-release-weight: 0
    label: alpha
  release:
    regex: ^releases?[/-]
    mode: ContinuousDelivery
    source-branches: ["develop", "release"]
    is-release-branch: true
    label: ""
  pull-request:
    regex: ^(pull|pull\-requests|pr)[/-]
    mode: ContinuousDelivery
    increment: Inherit
    # tag-number-pattern: '[/-](?<number>\d+)[-/]'
    source-branches: ["develop", "release", "feature", "pull-request"]
    label: PullRequest
  task:
    regex: ^task[/-]
    mode: ContinuousDelivery
    source-branches: ["develop", "task", "feature"]
    label: beta

Thanks for any help!

What is expected?

.\dotnet-gitversion /updateprojectfiles /output json /l console /diag /verbosity Diagnostic /nocache /nofetch only takes a couple of minutes at most.

Steps to Reproduce

Unclear.

RepositoryFixture Test

No response

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

Installing GitVersion via dotnet tool install.
You can invoke the tool using the following command: dotnet-gitversion
Tool 'gitversion.tool' (version '6.1.0') was successfully installed.
Will execute command '.\dotnet-gitversion /updateprojectfiles /output json /l console /diag /verbosity Diagnostic /nocache /nofetch /overrideconfig update-build-number=false'.
Running GitVersion to update projects and log results.
INFO [25-02-11 12:02:58:15] Working directory: C:\SP\agent\_work\1284\s
INFO [25-02-11 12:02:58:21] Project root is: C:\SP\agent\_work\1284\s\
INFO [25-02-11 12:02:58:21] DotGit directory is: C:\SP\agent\_work\1284\s\.git
INFO [25-02-11 12:02:58:21] Branch from build environment: refs/pull/14311/merge
INFO [25-02-11 12:02:58:21] -< Begin: Normalizing git directory for branch 'refs/pull/14311/merge' >-
  INFO [25-02-11 12:02:58:26] One remote found (origin -> '<redacted>').
  INFO [25-02-11 12:02:58:27] Skipping fetching, if GitVersion does not calculate your version as expected you might need to allow fetching or use dynamic repositories
  INFO [25-02-11 12:02:58:38] Creating local branch pull/14311/merge pointing at 21b3b8c
... (nothing out of the ordinary here)
  INFO [25-02-11 12:03:54:91] -< End: Finding branches source of 'pull/14311/merge' (Took: 47,523.95ms) >-
  INFO [25-02-11 12:28:05:49] -< Begin: Finding branches source of '<redacted>' >-
... (as you can see, in between these steps it didn't output for almost 25 minutes)
      INFO [25-02-11 12:29:37:13] Found merge base of ''18536b8' - Merged PR 3740: Implement SettingsDbIntegrationTest'
      INFO [25-02-11 12:38:15:21] Merge base of '<redacted>' and 'origin/release/0.7.0' is ''18536b8' - <redacted>'
... (above it took almost 9 minutes)
      INFO [25-02-11 12:38:32:41] -< Begin: Getting tagged semantic versions on branch 'refs/heads/release/0.11.1-alpha.1130'. TagPrefix: [vV]? and Format: Strict >-
      INFO [25-02-11 12:46:56:90] -< End: Getting tagged semantic versions on branch 'refs/heads/release/0.11.1-alpha.1130'. TagPrefix: [vV]? and Format: Strict (Took: 504,439.98ms) >-
... (above took 8 minutes)
      INFO [25-02-11 12:52:12:78] -< Begin: Getting tagged semantic versions on branch 'refs/heads/release/0.13.1'. TagPrefix: [vV]? and Format: Strict >-
      INFO [25-02-11 12:52:14:08] -< End: Getting tagged semantic versions on branch 'refs/heads/release/0.13.1'. TagPrefix: [vV]? and Format: Strict (Took: 1,287.87ms) >-
... (that it takes several minutes in between happens many times for "Getting tagged semantic versions on branch")
        INFO [25-02-11 13:59:19:05] Found merge base of ''dd19d3b' - <redacted>'
        INFO [25-02-11 14:16:49:38] Merge base of 'release/0.11.0-alpha.861' and 'pull/14311/merge' is ''dd19d3b' - <redacted>'
... (another occurrence where the merge base stuff takes several minutes, happens several times following this occurrence)
        INFO [25-02-11 14:54:14:18] Found merge base of ''2a0ef1d' - <redacted>'
        INFO [25-02-11 15:23:55:74] next merge base --> '9f0df83' - <redacted>
... (above is an occurrence where going to the next merge base takes almost 30 minutes)
... (and so on for about 5 hours until the task timed out)
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

1 participant