Skip to content

Implement versioned calculation and output configuration - #5158

Merged
arturcic merged 5 commits into
mainfrom
feature/5132-versioned-configuration
Sep 7, 2026
Merged

Implement versioned calculation and output configuration#5158
arturcic merged 5 commits into
mainfrom
feature/5132-versioned-configuration

Conversation

@arturcic

@arturcic arturcic commented Aug 19, 2026

Copy link
Copy Markdown
Member

Summary

  • Implements v7 configuration with a root-level workflow preset selector and separate calculation and output sections.
  • Workflow templates supply defaults for both sections; user configuration and runtime overrides retain their precedence.
  • Accepts empty/workflow-only documents in both formats, rejects nested workflow selectors with actionable guidance, and preserves the v6 fallback.
  • Updates model/API ownership, serialization, overrides, and the generated v7 schema.

Validation

  • Independent PR head: configuration tests — 142 passed; app tests — 376 passed.
  • Full-stack solution build and scoped dotnet format.
  • Schema generation repeated with identical output.

Closes #5132

@mergify

mergify Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

⚠️ The sha of the head commit of this PR conflicts with #5155. Mergify cannot evaluate rules on this PR. Once #5155 is merged or closed, Mergify will resume processing this PR. ⚠️

@arturcic
arturcic force-pushed the feature/5132-versioned-configuration branch 4 times, most recently from 5f5d629 to eb5b85a Compare August 20, 2026 01:31
@arturcic
arturcic force-pushed the feature/5132-versioned-configuration branch from eb5b85a to 294eb09 Compare August 28, 2026 18:16
@arturcic
arturcic force-pushed the feature/5132-versioned-configuration branch from 294eb09 to 8d5f4bd Compare September 6, 2026 12:41
@arturcic
arturcic marked this pull request as ready for review September 6, 2026 15:55
Copilot AI lite review requested due to automatic review settings September 6, 2026 15:55

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.

🔵 Needs a closer look

It introduces broad, version-dependent configuration parsing/serialization and CLI override behavior changes across multiple subsystems, warranting final human review despite test updates.

Pull request overview

This PR introduces a version-aware GitVersion configuration model by splitting settings into nested calculation and output sections, with runtime selection controlled by GITVERSION_CONFIGURATION_VERSION (defaulting to v7 while retaining v6 compatibility via explicit selection). It updates configuration serialization/deserialization, workflow docs/baselines, CLI/MSBuild override parsing, and cache key computation to ensure consistent behavior across both structures.

Changes:

  • Added version selection (v6/v7) and normalization/mapping between nested and flat configuration documents.
  • Split configuration surface area into new ICalculation* and IOutput* interfaces and updated builders/serialization accordingly.
  • Updated override-config parsing/validation, cache keys, tests, workflow baselines, and docs to reflect the nested structure.
File summaries
File Description
src/GitVersion.MsBuild.Tests/Tasks/WriteVersionInfoTest.cs Update MSBuild test YAML to nested config
src/GitVersion.Core/VersionCalculation/Caching/GitVersionCacheKeyFactory.cs Include configuration-version in cache key
src/GitVersion.Core/PublicAPI.Unshipped.txt Record new public interfaces for API analyzers
src/GitVersion.Core/Configuration/IOutputConfiguration.cs New output configuration interface
src/GitVersion.Core/Configuration/IOutputBranchConfiguration.cs New output branch configuration interface
src/GitVersion.Core/Configuration/IGitVersionConfiguration.cs Add Calculation/Output to top-level config
src/GitVersion.Core/Configuration/ICalculationConfiguration.cs New calculation configuration interface
src/GitVersion.Core/Configuration/ICalculationBranchConfiguration.cs New calculation branch configuration interface
src/GitVersion.Core/Configuration/IBranchConfiguration.cs Make branch config extend calc+output branch interfaces
src/GitVersion.Core/Configuration/ConfigurationVersion.cs Add version selector based on env var
src/GitVersion.Core.Tests/Core/GitVersionExecutorTests.cs Cache invalidation test for config version changes
src/GitVersion.Core.Tests/Core/ConfigurationVersionSelectorTests.cs Unit tests for selector parsing/fail-fast behavior
src/GitVersion.Configuration/GitVersionConfiguration.cs Add Calculation/Output facades and cached projections
src/GitVersion.Configuration/ConfigurationSerializer.cs Version-aware read/serialize with nesting/flattening
src/GitVersion.Configuration/ConfigurationProvider.cs Normalize file/workflow/override inputs by version
src/GitVersion.Configuration/ConfigurationHelper.cs Force legacy serialization for helper scenarios
src/GitVersion.Configuration/ConfigurationDocumentMapper.cs New mapper: detect/flatten/nest + ownership validation
src/GitVersion.Configuration/Builders/ConfigurationBuilderBase.cs Read from Calculation/Output when copying config
src/GitVersion.Configuration/BranchConfiguration.cs Add explicit interface projections for calc branch members
src/GitVersion.Configuration.Tests/Workflows/approved/TrunkBased/preview1.yml Approved baseline updated to nested structure
src/GitVersion.Configuration.Tests/Workflows/approved/GitHubFlow/v1.yml Approved baseline updated to nested structure
src/GitVersion.Configuration.Tests/Workflows/approved/GitFlow/v1.yml Approved baseline updated to nested structure
src/GitVersion.Configuration.Tests/Configuration/IgnoreConfigurationTests.cs Tests updated to new configuration read path/versioning
src/GitVersion.Configuration.Tests/Configuration/ConfigurationSerializerTests.cs Tests for v6/v7 serialization and projection caching
src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs Tests for merging, parity, and mismatch detection
src/GitVersion.Configuration.Tests/Configuration/ConfigurationDocumentMapperTests.cs New tests for mapping rules and ownership validation
src/GitVersion.Configuration.Tests/AssemblyParallelizable.cs Disable parallelization (env-var sensitive tests)
src/GitVersion.App/OverrideConfigurationOptionParser.cs Version-aware override path validation + nested dictionary output
src/GitVersion.App/LegacyArgumentParser.cs Route override parsing through new batch validator
src/GitVersion.App/GitVersionExecutor.cs Treat ConfigurationException like WarningException + stderr output
src/GitVersion.App/ArgumentParser.cs Route override parsing through new batch validator
src/GitVersion.App.Tests/PullRequestInBuildAgentTest.cs Update embedded config snippet to nested format
src/GitVersion.App.Tests/LegacyArgumentParserTests.cs Add tests for v6/v7 override paths and replacements
src/GitVersion.App.Tests/ConfigurationVersionIntegrationTests.cs New integration tests for parity and error output
src/GitVersion.App.Tests/ArgumentParserTests.cs Add tests for nested override paths, casing, dotted branch rejection
docs/input/docs/workflows/TrunkBased/preview1.yml Docs workflow YAML updated to nested format
docs/input/docs/workflows/GitHubFlow/v1.yml Docs workflow YAML updated to nested format
docs/input/docs/workflows/GitFlow/v1.yml Docs workflow YAML updated to nested format
docs/input/docs/reference/mdsource/configuration.source.md Update example snippet to nested calculation section
docs/input/docs/reference/configuration.md Update reference content/snippets for nested structure
.gitversion.yml Repo’s own config migrated to nested structure
.github/workflows/docs.yml Cache key includes .gitversion.yml
.github/workflows/_prepare.yml Cache key includes .gitversion.yml
.github/actions/cache-restore/action.yml Cache key includes .gitversion.yml
Review details
  • Files reviewed: 44/44 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/GitVersion.Configuration/ConfigurationProvider.cs Outdated
@arturcic
arturcic force-pushed the feature/5132-versioned-configuration branch from 8d5f4bd to 609b592 Compare September 6, 2026 16:15
Copilot AI review requested due to automatic review settings September 6, 2026 16:15

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.

🟡 Changes recommended

src/GitVersion.Configuration/GitVersionConfiguration.cs contains malformed ToDictionary lambda expressions that will not compile.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (2)

src/GitVersion.Configuration/GitVersionConfiguration.cs:180

  • This ToDictionary value selector is malformed (ICalculationBranchConfiguration (element) => ...) and will not compile. It should cast the branch config value to ICalculationBranchConfiguration.
    src/GitVersion.Configuration/GitVersionConfiguration.cs:210
  • This ToDictionary value selector is malformed (IOutputBranchConfiguration (element) => ...) and will not compile. It should cast element.Value to IOutputBranchConfiguration.
  • Files reviewed: 44/44 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/GitVersion.Configuration/GitVersionConfiguration.cs

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.

🔵 Needs a closer look

It changes configuration shape, selection, normalization, override parsing, and caching across multiple entry points, which warrants final human review despite strong test coverage.

Review details
  • Files reviewed: 44/44 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@arturcic
arturcic requested review from HHobeck and asbjornu September 6, 2026 16:59

@asbjornu asbjornu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As I wrote in #5160 (review); with accompanying new gitversion calculate and gitversion output commands, I support these configuration changes! 👍🏼

@mergify

mergify Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

Copilot AI review requested due to automatic review settings September 7, 2026 10:33
@arturcic
arturcic force-pushed the feature/5132-versioned-configuration branch from 609b592 to 5fc9820 Compare September 7, 2026 10:33

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.

🟡 Changes recommended

The docs and .gitversion.yml currently demonstrate/encode workflow nested under calculation, which contradicts the v7 root-level workflow requirement and will produce invalid configurations.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 47/47 changed files
  • Comments generated: 3
  • Review effort level: Lite

Comment thread .gitversion.yml
Comment thread docs/input/docs/reference/configuration.md
Comment thread docs/input/docs/reference/mdsource/configuration.source.md
Copilot AI review requested due to automatic review settings September 7, 2026 10:44

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.

🟡 Changes recommended

The Mixed-document diagnostic message is misleading for certain nested-doc root-key combinations and should be clarified before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 47/47 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/GitVersion.Configuration/ConfigurationDocumentMapper.cs
Copilot AI review requested due to automatic review settings September 7, 2026 10:56
@arturcic
arturcic force-pushed the feature/5132-versioned-configuration branch from 09f1be0 to 7cb5933 Compare September 7, 2026 10:56

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.

🔵 Needs a closer look

The change spans configuration modeling, public API surface, schema generation, CLI/MSBuild behavior, caching, and docs/tests, making it high-impact and better suited for final human verification.

Review details
  • Files reviewed: 47/47 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 7, 2026 11:04
@arturcic
arturcic force-pushed the feature/5132-versioned-configuration branch from 7cb5933 to 88af5c8 Compare September 7, 2026 11:04
@sonarqubecloud

sonarqubecloud Bot commented Sep 7, 2026

Copy link
Copy Markdown

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.

🟢 Approval recommended

The changes appear consistent across schema generation, configuration mapping/serialization, CLI overrides, caching, and tests/docs, with coverage added for version selection and mismatch scenarios.

Review details
  • Files reviewed: 47/47 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@arturcic
arturcic requested a review from asbjornu September 7, 2026 11:56
@arturcic
arturcic merged commit 7d7f0fb into main Sep 7, 2026
73 of 74 checks passed
@arturcic
arturcic deleted the feature/5132-versioned-configuration branch September 7, 2026 15:39
@mergify

mergify Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Thank you @arturcic for your contribution!

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.

Implement versioned calculation and output configuration

3 participants