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]: remote compute with /url and /b #4230

Open
2 tasks done
xpicio opened this issue Sep 26, 2024 · 3 comments
Open
2 tasks done

[ISSUE]: remote compute with /url and /b #4230

xpicio opened this issue Sep 26, 2024 · 3 comments

Comments

@xpicio
Copy link

xpicio commented Sep 26, 2024

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.0.1 and 6.0.2

Operating system

macOS

What are you seeing?

Hello, i tried upgrading gitversion 5.12 to 6.0.2 to use this new feature #3453, but there seems to be an issue using the parameters /url and /b. I also tried computing the version locally, and that works fine. The command docker run --rm -v $(pwd):/repo gittools/gitversion:6.0.2 /repo works correctly, but I rely heavily on the remote mode.

6.0.1 on develop with remote repository:

❯ docker run --rm gittools/gitversion:6.0.1 /url https://github.com/xpicio/compute-version.git /b develop
INFO [24-09-26 15:37:17:58] Applicable build agent found: 'LocalBuild'.
INFO [24-09-26 15:37:17:61] Working directory: /tools
INFO [24-09-26 15:37:17:62] Project root is: /tools
INFO [24-09-26 15:37:17:62] DotGit directory is: /tmp/compute-version/.git
INFO [24-09-26 15:37:17:62] Branch from build environment: develop
INFO [24-09-26 15:37:17:62] -< Begin: Creating dynamic repository at '/tmp/compute-version/.git' >-
  INFO [24-09-26 15:37:17:63] -< Begin: Cloning repository from url 'https://github.com/xpicio/compute-version.git' >-
    INFO [24-09-26 15:37:18:02] Returned path after repository clone: /tmp/compute-version/.git/
  INFO [24-09-26 15:37:18:02] -< End: Cloning repository from url 'https://github.com/xpicio/compute-version.git' (Took: 392.82ms) >-
INFO [24-09-26 15:37:18:02] -< End: Creating dynamic repository at '/tmp/compute-version/.git' (Took: 395.21ms) >-
INFO [24-09-26 15:37:18:02] -< Begin: Normalizing git directory for branch 'develop' >-
INFO [24-09-26 15:37:18:03] -< End: Normalizing git directory for branch 'develop' (Took: 6.64ms) >-
ERROR [24-09-26 15:37:18:05] An unexpected error occurred:
System.ArgumentNullException: Value cannot be null. (Parameter 'path')
   at LibGit2Sharp.Core.Ensure.ArgumentNotNull(Object argumentValue, String argumentName) in /_/LibGit2Sharp/Core/Ensure.cs:line 24
   at LibGit2Sharp.Core.Ensure.ArgumentNotNullOrEmptyString(String argumentValue, String argumentName) in /_/LibGit2Sharp/Core/Ensure.cs:line 50
   at LibGit2Sharp.Repository..ctor(String path, RepositoryOptions options, RepositoryRequiredParameter requiredParameter) in /_/LibGit2Sharp/Repository.cs:line 149
   at LibGit2Sharp.Repository..ctor(String path) in /_/LibGit2Sharp/Repository.cs:line 70
   at GitVersion.Git.GitRepository.<>c__DisplayClass23_0.<DiscoverRepository>b__0() in /_/src/GitVersion.LibGit2Sharp/Git/GitRepository.cs:line 37
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at GitVersion.Git.GitRepository.get_RepositoryInstance() in /_/src/GitVersion.LibGit2Sharp/Git/GitRepository.cs:line 15
   at GitVersion.Git.GitRepository.get_Head() in /_/src/GitVersion.LibGit2Sharp/Git/GitRepository.cs:line 24
   at GitVersion.GitPreparer.NormalizeGitDirectory(Boolean noFetch, String currentBranchName, Boolean isDynamicRepository) in /_/src/GitVersion.Core/Core/GitPreparer.cs:line 153
   at GitVersion.GitPreparer.NormalizeGitDirectory(String targetBranch, Boolean isDynamicRepository) in /_/src/GitVersion.Core/Core/GitPreparer.cs:line 131
   at GitVersion.GitPreparer.PrepareInternal(GitVersionOptions gitVersionOptions) in /_/src/GitVersion.Core/Core/GitPreparer.cs:line 55
   at GitVersion.GitPreparer.Prepare() in /_/src/GitVersion.Core/Core/GitPreparer.cs:line 45
   at GitVersion.GitVersionCalculateTool.CalculateVersionVariables() in /_/src/GitVersion.Core/Core/GitVersionCalculateTool.cs:line 35
   at GitVersion.GitVersionExecutor.RunGitVersionTool(GitVersionOptions gitVersionOptions) in /_/src/GitVersion.App/GitVersionExecutor.cs:line 66
INFO [24-09-26 15:37:18:05] Attempting to show the current git graph (please include in issue):
INFO [24-09-26 15:37:18:05] Showing max of 100 commits
INFO [24-09-26 15:37:18:08] ERROR: fatal: not a git repository (or any of the parent directories): .git

6.0.2 on develop with remote repository:

❯ docker run --rm gittools/gitversion:6.0.2 /url https://github.com/xpicio/compute-version.git /b develop
INFO [24-09-26 15:24:55:68] Applicable build agent found: 'LocalBuild'.
INFO [24-09-26 15:24:55:71] Working directory: /tools
INFO [24-09-26 15:24:55:71] Project root is: /tools
INFO [24-09-26 15:24:55:71] DotGit directory is: /tmp/compute-version/.git
INFO [24-09-26 15:24:55:71] Branch from build environment: develop
INFO [24-09-26 15:24:55:71] -< Begin: Creating dynamic repository at '/tmp/compute-version/.git' >-
  INFO [24-09-26 15:24:55:72] -< Begin: Cloning repository from url 'https://github.com/xpicio/compute-version.git' >-
    INFO [24-09-26 15:24:56:07] Returned path after repository clone: /tmp/compute-version/.git/
  INFO [24-09-26 15:24:56:07] -< End: Cloning repository from url 'https://github.com/xpicio/compute-version.git' (Took: 355.67ms) >-
INFO [24-09-26 15:24:56:07] -< End: Creating dynamic repository at '/tmp/compute-version/.git' (Took: 357.94ms) >-
INFO [24-09-26 15:24:56:07] -< Begin: Normalizing git directory for branch 'develop' >-
INFO [24-09-26 15:24:56:08] -< End: Normalizing git directory for branch 'develop' (Took: 3.53ms) >-
ERROR [24-09-26 15:24:56:09] An unexpected error occurred:
System.ArgumentNullException: Value cannot be null. (Parameter 'path')
   at LibGit2Sharp.Core.Ensure.ArgumentNotNull(Object argumentValue, String argumentName) in /_/LibGit2Sharp/Core/Ensure.cs:line 24
   at LibGit2Sharp.Core.Ensure.ArgumentNotNullOrEmptyString(String argumentValue, String argumentName) in /_/LibGit2Sharp/Core/Ensure.cs:line 50
   at LibGit2Sharp.Repository..ctor(String path, RepositoryOptions options, RepositoryRequiredParameter requiredParameter) in /_/LibGit2Sharp/Repository.cs:line 149
   at LibGit2Sharp.Repository..ctor(String path) in /_/LibGit2Sharp/Repository.cs:line 70
   at GitVersion.Git.GitRepository.<>c__DisplayClass23_0.<DiscoverRepository>b__0() in /_/src/GitVersion.LibGit2Sharp/Git/GitRepository.cs:line 37
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at GitVersion.Git.GitRepository.get_RepositoryInstance() in /_/src/GitVersion.LibGit2Sharp/Git/GitRepository.cs:line 15
   at GitVersion.Git.GitRepository.get_Head() in /_/src/GitVersion.LibGit2Sharp/Git/GitRepository.cs:line 24
   at GitVersion.GitPreparer.NormalizeGitDirectory(Boolean noFetch, String currentBranchName, Boolean isDynamicRepository) in /_/src/GitVersion.Core/Core/GitPreparer.cs:line 153
   at GitVersion.GitPreparer.NormalizeGitDirectory(String targetBranch, Boolean isDynamicRepository) in /_/src/GitVersion.Core/Core/GitPreparer.cs:line 131
   at GitVersion.GitPreparer.PrepareInternal(GitVersionOptions gitVersionOptions) in /_/src/GitVersion.Core/Core/GitPreparer.cs:line 55
   at GitVersion.GitPreparer.Prepare() in /_/src/GitVersion.Core/Core/GitPreparer.cs:line 45
   at GitVersion.GitVersionCalculateTool.CalculateVersionVariables() in /_/src/GitVersion.Core/Core/GitVersionCalculateTool.cs:line 35
   at GitVersion.GitVersionExecutor.RunGitVersionTool(GitVersionOptions gitVersionOptions) in /_/src/GitVersion.App/GitVersionExecutor.cs:line 66
INFO [24-09-26 15:24:56:09] Please run `git log --graph --format="%h %cr %d" --decorate --date=relative --all --remotes=*` to see the git graph. This can help you troubleshoot any issues.

What is expected?

6.0.0-rc.2 on develop with remote repository -> 0.3.0-alpha.0

❯ docker run --rm gittools/gitversion:6.0.0-rc.2 /url https://github.com/xpicio/compute-version.git /b develop
{
  "AssemblySemFileVer": "0.3.0.0",
  "AssemblySemVer": "0.3.0.0",
  "BranchName": "develop",
  "BuildMetaData": null,
  "CommitDate": "2023-03-29",
  "CommitsSinceVersionSource": 0,
  "EscapedBranchName": "develop",
  "FullBuildMetaData": "Branch.develop.Sha.53720f5d878cbc9eab27fbb127615c3e85971409",
  "FullSemVer": "0.3.0-alpha.0",
  "InformationalVersion": "0.3.0-alpha.0+Branch.develop.Sha.53720f5d878cbc9eab27fbb127615c3e85971409",
  "Major": 0,
  "MajorMinorPatch": "0.3.0",
  "Minor": 3,
  "Patch": 0,
  "PreReleaseLabel": "alpha",
  "PreReleaseLabelWithDash": "-alpha",
  "PreReleaseNumber": 0,
  "PreReleaseTag": "alpha.0",
  "PreReleaseTagWithDash": "-alpha.0",
  "SemVer": "0.3.0-alpha.0",
  "Sha": "53720f5d878cbc9eab27fbb127615c3e85971409",
  "ShortSha": "53720f5",
  "UncommittedChanges": 0,
  "VersionSourceSha": "53720f5d878cbc9eab27fbb127615c3e85971409",
  "WeightedPreReleaseNumber": 0
}

6.0.0-rc.2 on main with remote repository -> 0.2.4

❯ docker run --rm gittools/gitversion:6.0.0-rc.2 /url https://github.com/xpicio/compute-version.git /b main
{
  "AssemblySemFileVer": "0.2.4.0",
  "AssemblySemVer": "0.2.4.0",
  "BranchName": "main",
  "BuildMetaData": null,
  "CommitDate": "2023-03-29",
  "CommitsSinceVersionSource": 0,
  "EscapedBranchName": "main",
  "FullBuildMetaData": "Branch.main.Sha.53720f5d878cbc9eab27fbb127615c3e85971409",
  "FullSemVer": "0.2.4",
  "InformationalVersion": "0.2.4+Branch.main.Sha.53720f5d878cbc9eab27fbb127615c3e85971409",
  "Major": 0,
  "MajorMinorPatch": "0.2.4",
  "Minor": 2,
  "Patch": 4,
  "PreReleaseLabel": "",
  "PreReleaseLabelWithDash": "",
  "PreReleaseNumber": null,
  "PreReleaseTag": "",
  "PreReleaseTagWithDash": "",
  "SemVer": "0.2.4",
  "Sha": "53720f5d878cbc9eab27fbb127615c3e85971409",
  "ShortSha": "53720f5",
  "UncommittedChanges": 0,
  "VersionSourceSha": "53720f5d878cbc9eab27fbb127615c3e85971409",
  "WeightedPreReleaseNumber": 60000
}

Steps to Reproduce

Simply run:

docker run --rm gittools/gitversion:6.0.1 /url https://github.com/xpicio/compute-version.git /b develop

docker run --rm gittools/gitversion:6.0.2 /url https://github.com/xpicio/compute-version.git /b develop

RepositoryFixture Test

No response

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

No response

@xpicio xpicio changed the title [ISSUE]: <title> [ISSUE]: compute with /url Sep 26, 2024
@xpicio xpicio changed the title [ISSUE]: compute with /url [ISSUE]: remote compute with /url and /b Sep 26, 2024
@arturcic
Copy link
Member

arturcic commented Oct 4, 2024

I think we will remove the support of dynamic repository in the tool as I think it should be the responsibility of the developer that uses the tool to prepare the git repository for the tool to compute the version.

@xpicio
Copy link
Author

xpicio commented Oct 4, 2024

Thanks for the update.

Just to clarify, will the current issue we're facing be fixed, and are you planning to remove the dynamic repository support in a new major release 7.x.x ? Or will the dynamic repository support remain broken in the 6.x.x releases ?

@arturcic
Copy link
Member

arturcic commented Oct 4, 2024

I think it will be removed in v7 as part of the cli refactoring. If you want to invest some time in debugging it and filling in a PR, that work would be much appreciated and possibly included in the v6

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

2 participants