Skip to content

breaking: move the GitVersion providers to GitVersion 7 - #414

Draft
DecSmith42 wants to merge 2 commits into
mainfrom
claude/laughing-ptolemy-ls6ira
Draft

DecSmith42 wants to merge 2 commits into
mainfrom
claude/laughing-ptolemy-ls6ira

Conversation

@DecSmith42

@DecSmith42 DecSmith42 commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #412. Follows #413 (merged), which pinned GitVersion 6.8.2 as a hotfix.

Summary

#413 pins the tool and makes IDotnetToolInstallHelper allow downgrades. This PR moves that pin to GitVersion.Tool 7.0.0 and updates the providers for v7's breaking changes:

GitVersion 6 GitVersion 7 Change here
dotnet gitversion /output json /-style arguments rejected: Could not parse command line parameter '/output'. Run dotnet gitversion --output json (GitVersionTool.OutputJsonArguments)
PreReleaseTag = beta.x.4 renamed to PreReleaseLabel GitVersionBuildVersionProvider reads PreReleaseLabel
PreReleaseLabel = beta.x renamed to PreReleaseLabelName The cache key now includes the tool version (see below)
Flat GitVersion.yml Needs calculation: / output: sections This repo's GitVersion.yml is migrated

Why the cache key changed. .gitversioncache was keyed only by the Git hash. Output cached by v6 on the same commit would have been reused, and v6's PreReleaseLabel lacks the pre-release number. The version would have dropped the .N suffix with no error. The key is now <tool version>:<git hash>, so any existing cache entry is a miss and gets overwritten.

Changes

  • Providers. GitVersionTool.Version is 7.0.0, and OutputJsonArguments is gitversion --output json. Both providers use them, and the version provider reads PreReleaseLabel.
  • Cache. GitVersionCache keys entries by tool version and Git hash.
  • GitVersion.yml. Restructured into calculation: and output:, with {PreReleaseTagWithDash} renamed to {PreReleaseLabelWithDash}. I did it by hand rather than keeping the output of gitversion config migrate, because the migration drops the file's comments.
  • Tests. New Invex.Atom.Module.GitVersion.Tests project with 5 tests: the pinned version, the v7 arguments, PreReleaseLabel parsing, FullSemVer as the build ID, cache reuse, and ignoring v6-format cache entries. It's registered in Invex.Atom.slnx and ITestTargets, and .github/workflows/Build.yml and .devops/workflows/Test_Devops_Build.yml are regenerated with atom gen.
  • Docs. docs/modules/git-version.md gives the pinned version and how to migrate a v6 config.

Breaking change for consumers

Builds using IGitVersion now run GitVersion 7, which rejects the GitVersion 6 config layout with: The configuration file uses the legacy v6 configuration structure ... Run 'gitversion config migrate'. Consumers must run dotnet gitversion config migrate --in-place and rename any PreReleaseTag* format variables to PreReleaseLabel*. The commit uses the breaking: prefix, so the release will bump the major version. If you'd rather ship this as a minor or patch, the commit needs rewording before merge, because GitVersion reads the branch commits.

Testing

  • dotnet build Invex.Atom.slnx: 0 warnings, 0 errors.
  • dotnet test Invex.Atom.slnx: all passing on net10.0 and net11.0, including the 5 new tests. I checked that the cache test fails if the tool version is removed from the cache key, and that the tool test fails with the old version and arguments.
  • Config equivalence. I compared the old config on 6.8.2 with the migrated config on 7.0.0, on throwaway clones checked out as main, feat/thing, fix/bug, patch/1.2, develop, pr/5, random and a v9.9.9 tag. FullSemVer, the pre-release, InformationalVersion and AssemblySemFileVer matched on every one.
  • End to end. I ran dotnet run --project _atom -- SetupBuildInfo with GitVersion 6.8.2 installed globally and a v6-format cache entry planted. The tool upgraded to 7.0.0 and the stale cache was ignored. Build ID and Build Version came out as 5.3.1-alpha.claude-laughing-ptolemy-ls6ira.1, and the cache was rewritten as 7.0.0:<hash>.
  • GitVersion.Tool 7.0.0 still publishes an osx-x64 tool package, so the macos-15-intel CI runners can install it. v7 only dropped the standalone Intel macOS archives.

Open question: telemetry

GitVersion 7 sends sampled CLI usage telemetry by default. Atom shows this as a build warning every time GitVersion runs: "GitVersion may send sampled CLI usage data to PostHog Cloud. Opt out with --telemetry-opt-out or DO_NOT_TRACK=1." This PR doesn't opt out. Adding --telemetry-opt-out to OutputJsonArguments would silence the warning and opt every consumer out.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NmBdNrhc5dVcJV7JXypNEJ

Pin GitVersion.Tool to 7.0.0 and update the providers for its breaking
changes:

- Run `dotnet gitversion --output json`; v7 no longer accepts the
  `/output json` syntax.
- Read the pre-release from `PreReleaseLabel`; v7 renamed `PreReleaseTag`
  to `PreReleaseLabel`, and the old `PreReleaseLabel` (the label without
  the number) to `PreReleaseLabelName`.
- Include the tool version in the GitVersion output cache key, so output
  cached by GitVersion 6 (where `PreReleaseLabel` means something else)
  is never reused.

Migrate this repository's GitVersion.yml to the v7 `calculation:` /
`output:` layout and the renamed `{PreReleaseLabelWithDash}` variable.
The resulting versions are unchanged for main, patch, develop, feature,
pull request, other and tagged builds.

Add Invex.Atom.Module.GitVersion.Tests covering the pinned version, the
v7 arguments and variables, and cache invalidation.

BREAKING CHANGE: builds using IGitVersion now run GitVersion 7, which
rejects the GitVersion 6 configuration layout. Migrate GitVersion.yml with
`dotnet gitversion config migrate --in-place` and rename
`PreReleaseTag*` variables in format strings to `PreReleaseLabel*`.

Closes #412

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NmBdNrhc5dVcJV7JXypNEJ
@DecSmith42
DecSmith42 changed the base branch from fix/cld-pin-gitversion-6 to main November 18, 2026 01:40

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GitVersion Build* providers do not pin the GitVersion tool version

2 participants