Skip to content

[Feature] Group configuration under calculation and output sections with migration support #5131

Description

@arturcic

Summary

Restructure GitVersion configuration into calculation and output sections, add POSIX migration tooling, and provide a one-release fallback for the legacy flat configuration.

This umbrella is implemented through #5132, #5133, and #5134. The cross-feature release matrix and selector lifecycle are governed by #5135.

Progress

Follow-up release work is outside this completed umbrella: #5135 owns v7.0 selector/default alignment; #5188 owns v7.1 parser/configuration runtime removal; #5040 owns v7.1 backend removal; #5136 owns v8 selector removal.

Proposed structure

workflow: GitFlow/v1
calculation:
  tag-prefix: '[vV]?'
  semantic-version-format: Strict
  strategies: [ConfiguredNextVersion, MergeMessage, TaggedCommit]
  ignore:
    sha: []
    paths: []
  branches:
    main:
      regex: ^master$|^main$
      mode: ContinuousDelivery
      label: ''
      increment: Patch

output:
  assembly-versioning-scheme: MajorMinorPatch
  assembly-file-versioning-scheme: MajorMinorPatch
  assembly-informational-format: '{InformationalVersion}'
  commit-date-format: yyyy-MM-dd
  tag-pre-release-weight: 60000
  update-build-number: true
  branches:
    main:
      custom-version-format: '{SemVer}'
      pre-release-weight: 55000

Setting ownership

workflow is a root-level preset selector for the whole configuration. Templates supply defaults to both calculation and output; user configuration overrides the preset, and runtime overrides take precedence. A workflow-only document is valid in both v6 and v7.

calculation contains semantic-version and Git-history inputs:

  • next-version, tag-prefix, and version-in-branch-pattern
  • version-bump and no-bump message patterns
  • merge-message-formats, semantic-version-format, strategies, and ignore
  • calculation branch defaults and calculation.branches: mode, label, increment, prevent-increment, merge tracking, commit-message incrementing, regex/source relationships, and branch classification

label remains a calculation setting because it changes SemVer and FullSemVer.

output contains generated-variable and output-integration settings:

  • assembly versioning schemes and formats
  • assembly-informational-format, commit-date-format, tag-pre-release-weight, and update-build-number
  • output branch defaults and output.branches: custom-version-format and pre-release-weight

Calculation and output entries for the same branch are merged logically. Output configuration may target a branch supplied by a built-in workflow without repeating its calculation configuration.

Configuration model and validation

  • Represent both sections explicitly in the configuration model.
  • Resolve v6 and v7 representations to equivalent effective runtime configuration during v7.0.
  • Reject documents mixing flat and nested settings.
  • Keep calculation consumers independent of output-only settings where practical.
  • Update built-in workflows, builders, inheritance, serialization, --show-config, overrides, caching, schemas, and public API baselines.

POSIX migration command

Add to the stable System.CommandLine parser:

gitversion config migrate
gitversion config migrate --config GitVersion.yml
gitversion config migrate --config GitVersion.yml --output GitVersion.v7.yml
gitversion config migrate --config GitVersion.yml --in-place
  • Default input uses normal configuration discovery and default output is stdout.
  • --output refuses overwrite without --force; --in-place explicitly replaces the input; both are mutually exclusive.
  • Migration is deterministic and idempotent and preserves all configured values.
  • Warn before in-place migration if comments cannot be preserved.
  • Explicit input does not require repository discovery or normalization.
  • The command exists only in the stable POSIX parser, not LegacyArgumentParser or experimental new-cli.
  • A positional directory named config uses the unambiguous --target-path config form.

Follow-up release matrix (tracked separately)

Use GITVERSION_CONFIGURATION_VERSION=v6|v7 as specified by #5135:

  • v7.0 defaults to nested v7 configuration; v6 is an explicit temporary fallback.
  • v7.1 removes runtime support for flat v6 configuration. v6 produces an actionable error directing users to gitversion config migrate.
  • Explicit v7 remains accepted as a no-op throughout v7.x.
  • Remove feature-selector environment variables #5136 removes the selector entirely in v8.

--show-config emits the selected format. In v7 mode, --override-config uses nested paths and rejects legacy paths with replacement guidance; v6 mode does the inverse.

Acceptance criteria

  • Every current setting has an explicit calculation or output destination.
  • custom-version-format and pre-release-weight work as output defaults and under output.branches.
  • v6 and v7 configurations have calculation/output parity in v7.0.
  • Nested v7 configuration and explicit v6 fallback are implemented; explicit v6 user-file loading warns. Cross-feature v7.0 default alignment is tracked by v7.0: default to v7 parser, nested configuration and managed Git #5135.
  • v7.1 runtime removal is outside this completed scope and tracked by v7.1: remove legacy argument parser and v6 configuration runtime #5188; migration tooling remains available.
  • Migration, overrides, workflows, --show-config, caching, serialization, schemas, docs, and public APIs are tested and updated.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions