Skip to content

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

Merged
DecSmith42 merged 2 commits into
mainfrom
feature/gh-412-gitversion-7
Dec 1, 2026
Merged

DecSmith42 merged 2 commits into
mainfrom
feature/gh-412-gitversion-7

Conversation

@DecSmith42

Copy link
Copy Markdown
Collaborator

Closes #412. Replaces #414 (closed): the same GitVersion 7 upgrade, redone on the current main. Since #414, #418 already added the tool version to the cache key, so that part of #414 is no longer needed here.

Summary

#413 pinned GitVersion.Tool to 6.8.2 as a hotfix. This PR moves the pin to 7.0.1 and updates the providers for GitVersion 7'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 Not read
Flat GitVersion.yml Needs calculation: / output: sections This repo's GitVersion.yml is migrated

7.0.1 only adds one fix on top of 7.0.0, for the TrunkBased workflow with ignore.paths.

Cache. No change is needed: since #418, GitVersionCacheKey includes GitVersionTool.Version and a hash of GitVersion.yml. Raising the pin invalidates any cache entry written by GitVersion 6, where PreReleaseLabel meant something different.

Commits

  1. breaking: move the GitVersion providers to GitVersion 7
    • Changes the pinned version, the arguments and the pre-release variable, as in the table above.
    • Migrates GitVersion.yml by hand, keeping its comments. gitversion config migrate drops comments and leaves the old {PreReleaseTagWithDash} variable in place.
    • Adds a Invex.Atom.Module.GitVersion.Tests project with 4 tests: the pinned version and arguments, PreReleaseLabel parsing, FullSemVer as the build ID, and cache reuse. It's registered in Invex.Atom.slnx and ITestTargets, and the workflows are regenerated with atom gen.
    • Updates docs/modules/git-version.md with migration guidance.
  2. feat: opt out of GitVersion telemetry
    • Passes --telemetry-opt-out. GitVersion 7 sends sampled usage telemetry by default, and Atom runs it for builds that never chose to run GitVersion directly.
    • On a fresh machine, which every CI runner is, the opt-out also removes the telemetry notice that GitVersion writes to stderr; Atom showed that notice as a WRN line in every build. It also skips the HTTP request (up to 1 s) that a sampled run waits on before calculating the version.
    • This is a separate commit so it's easy to drop if you'd rather leave telemetry to each consumer.

Breaking change for consumers

Builds using IGitVersion now run GitVersion 7, which rejects the GitVersion 6 config layout: 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 breaking: commit bumps the major version: this branch calculates 6.0.0-beta…. If you'd rather ship it as a minor or patch, the commit message needs rewording before merge.

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 new GitVersion tests.
  • End to end. I ran dotnet run --project _atom -- SetupBuildInfo with GitVersion 6.8.2 installed globally. The tool upgraded to 7.0.1, and Build ID and Build Version were 5.4.0-beta.feature-gh-412-gitversion-7.7 before the breaking: commit. With the opt-out in place, starting from no saved telemetry state, there was no telemetry warning and GitVersion wrote no telemetry state file.
  • Without --telemetry-opt-out. 7.0.1 printed GitVersion may send sampled CLI usage data to PostHog Cloud… on stderr on the first run. The JSON output was the same with and without the flag.
  • Config equivalence. breaking: move the GitVersion providers to GitVersion 7 #414 already compared the migrated config on GitVersion 7 against the old config on 6.8.2, on main, patch/*, develop, feat/*, fix/*, pr/*, other branches and a tag. Every version matched. GitVersion.yml hasn't changed on main since then.

Other GitVersion 7 options considered (not included)

  • $schema comment in GitVersion.yml. SchemaStore already maps GitVersion.yml to the 7.0 schema by default, so VS Code's YAML extension and Rider validate the migrated file without it.
  • gitversion config validate. It exits 1 on an invalid config and can report JSON diagnostics. It could become a CI or pre-flight step, but a normal run already fails with a clear message on a bad config.
  • --no-fetch, --no-normalize, --no-cache. These change how versions are calculated or cached on build servers, so I left GitVersion's defaults alone.
  • New label placeholders ({ShortSha}, {env:VAR ?? "fallback"}) and =semver: none|patch|minor|major commit messages. These are available if you want them, but the current branch labels and bump messages don't need them.

Generated by Claude Code

Copilot AI balanced review requested due to automatic review settings December 1, 2026 03:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approved

No active review issues remain for the GitVersion 7.0.1 upgrade.

No open issues 🎉

What changed in this PR

Updates Atom’s GitVersion providers to GitVersion 7.0.1, addressing #412 while retaining the version-aware cache introduced in #418. This is a breaking upgrade for consumers using GitVersion 6 configuration files.

Changes:

  • Updates both providers to GitVersion 7 arguments and output names, with telemetry disabled.
  • Migrates the repository configuration and documents consumer migration steps.
  • Adds four provider tests and integrates them into the solution, test targets, and generated workflows.
File Description
tests/​Invex.Atom.Module.GitVersion.Tests/​Invex.Atom.Module.GitVersion.Tests.csproj Adds a GitVersion test project targeting .NET 10 and 11.
tests/​Invex.Atom.Module.GitVersion.Tests/​GitVersionProviderTests.cs Tests version parsing, build IDs, tool invocation, and cache reuse.
tests/​Invex.Atom.Module.GitVersion.Tests/​_usings.cs Defines global imports for the new tests.
src/​Invex.Atom.Module.GitVersion/​Providers/​GitVersionTool.cs Pins 7.0.1 and centralizes arguments with telemetry opt-out.
src/​Invex.Atom.Module.GitVersion/​Providers/​GitVersionBuildVersionProvider.cs Uses the shared arguments and reads PreReleaseLabel.
src/​Invex.Atom.Module.GitVersion/​Providers/​GitVersionBuildIdProvider.cs Uses the shared GitVersion 7 arguments.
src/​Invex.Atom.Module.GitVersion/​Invex.Atom.Module.GitVersion.csproj Grants the test project access to internal members.
Invex.Atom.slnx Registers the GitVersion test project.
GitVersion.yml Migrates settings into calculation and output sections.
docs/​modules/​git-version.md Documents the new pin, telemetry opt-out, and migration requirements.
.github/​workflows/​Build.yml Adds upload and retrieval steps for GitVersion test artifacts.
.devops/​workflows/​Test_Devops_Build.yml Adds publication of GitVersion test artifacts.
_atom/​Targets/​ITestTargets.cs Includes GitVersion tests in the repository’s test target.

Review effort: Balanced

Pin GitVersion.Tool to 7.0.1 and update the providers for GitVersion 7's
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`.

The GitVersion cache key already includes the tool version, so output
cached by GitVersion 6 is not 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 reuse.

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
GitVersion 7 sends sampled CLI usage telemetry by default. Atom runs it
on behalf of builds that never chose to run GitVersion directly, so pass
`--telemetry-opt-out`. This also suppresses the telemetry notice that
GitVersion writes to standard error, which Atom surfaced as a warning on
every fresh machine, and the network request a sampled run waits on
before calculating the version.
@DecSmith42
DecSmith42 force-pushed the feature/gh-412-gitversion-7 branch from d3706f2 to 017ab8d Compare December 1, 2026 03:25
@DecSmith42
DecSmith42 marked this pull request as ready for review December 1, 2026 03:31
@DecSmith42
DecSmith42 merged commit 9e019c7 into main Dec 1, 2026
60 of 67 checks passed
@DecSmith42
DecSmith42 deleted the feature/gh-412-gitversion-7 branch December 1, 2026 03:31
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