Skip to content

Commit e358ee3

Browse files
committed
docs: document v7 configuration migration
1 parent 366a23b commit e358ee3

10 files changed

Lines changed: 492 additions & 185 deletions

File tree

BREAKING_CHANGES.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,26 @@ The command-line interface has been migrated from Windows-style (`/switch` and s
5555

5656
As a temporary migration aid, set the environment variable `GITVERSION_USE_V6_ARGUMENT_PARSER=true` to restore the legacy `/switch` and `-switch` argument handling. This escape hatch will be removed in a future release.
5757

58+
### Configuration structure and migration
59+
60+
v7 configuration now separates calculation from output:
61+
62+
```yaml
63+
calculation:
64+
branches:
65+
main:
66+
increment: Patch
67+
output:
68+
update-build-number: true
69+
```
70+
71+
v7.0 defaults to the nested layout. `GITVERSION_CONFIGURATION_VERSION=v6` is a
72+
temporary flat-layout fallback that logs a migration warning for user files.
73+
Convert files with `gitversion config migrate`. The command
74+
writes YAML to stdout by default, supports `--config`, `--output`,
75+
`--in-place`, and `--force`, and warns that comments cannot be preserved when
76+
replacing a file.
77+
5878
#### Full argument mapping
5979

6080
| Old argument | New argument | Short alias | Env var alternative |

docs/input/docs/learn/branching-strategies/gitflow/examples.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ in GitVersion. To enable this workflow, the builtin template
1212
configuration as follows:
1313

1414
```yaml
15-
workflow: GitFlow/v1
16-
mode: ContinuousDelivery
15+
calculation:
16+
mode: ContinuousDelivery
17+
workflow: GitFlow/v1
1718
```
1819
1920
Where

docs/input/docs/learn/branching-strategies/githubflow/examples.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ in GitVersion. To enable this workflow, the builtin template
1010
configuration as follows:
1111

1212
```yaml
13-
workflow: GitHubFlow/v1
14-
mode: ContinuousDelivery
13+
calculation:
14+
mode: ContinuousDelivery
15+
workflow: GitHubFlow/v1
1516
```
1617
1718
Where

docs/input/docs/migration/v6-to-v7.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,34 @@ gitversion --url https://github.com/org/repo.git --branch main --username user -
117117

118118
For current command details and examples, see [CLI Arguments](/docs/usage/cli/arguments).
119119

120+
## Configuration migration
121+
122+
GitVersion v7 stores settings under `calculation` and `output`. Convert an
123+
existing flat v6 YAML document with the POSIX-only migration command:
124+
125+
```shell
126+
gitversion config migrate
127+
gitversion config migrate --config GitVersion.yml --output GitVersion.v7.yml
128+
gitversion config migrate --config GitVersion.yml --in-place
129+
```
130+
131+
The first command discovers `GitVersion.yml` and emits v7 YAML to stdout.
132+
`--output` requires `--force` to replace an existing file and cannot be used
133+
with `--in-place`. In-place migration warns because comments cannot be
134+
preserved. The command does not need a Git repository and migrating its v7
135+
output again is idempotent. In v7.0, you can temporarily validate a flat file
136+
with `GITVERSION_CONFIGURATION_VERSION=v6`; GitVersion warns once for that
137+
fallback.
138+
139+
GitVersion 7 publishes a nested-only schema at
140+
`https://gitversion.net/schemas/7.0/GitVersion.configuration.json`. If you
141+
temporarily select `GITVERSION_CONFIGURATION_VERSION=v6`, keep the existing v6
142+
`$schema` reference (for example,
143+
`https://gitversion.net/schemas/6.3/GitVersion.configuration.json`) until you
144+
migrate. Do not point a flat document at the 7.0 schema. New v7 configuration
145+
settings require migrating to the nested layout with `gitversion config
146+
migrate` to retain schema validation.
147+
120148
## Git backend
121149

122150
GitVersion v7 introduces a fully managed Git backend as an alternative to the native LibGit2Sharp (libgit2) implementation. The backend is selected with the `GITVERSION_GIT_BACKEND` environment variable. When the variable is not set (or empty), the release's default backend is used — you never need to set it. Setting it to any value other than `libgit2` or `managed` (case-insensitive) is an error: GitVersion fails fast instead of silently running the default backend with a typo unnoticed.
@@ -138,7 +166,8 @@ The environment variables relevant to migrating from v6 to v7:
138166

139167
| Variable | Purpose |
140168
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
141-
| `GITVERSION_GIT_BACKEND` | Selects the Git backend: `libgit2` (default in v7.0) or `managed`. See [Git backend](#git-backend). |
169+
| `GITVERSION_CONFIGURATION_VERSION` | Selects the configuration layout: `v7` (default) or temporary flat `v6` fallback. |
170+
| `GITVERSION_GIT_BACKEND` | Selects the Git backend: `libgit2` (default in v7.0) or `managed`. See [Git backend](#git-backend). |
142171
| `GITVERSION_USE_V6_ARGUMENT_PARSER` | Set to `true` to temporarily restore the legacy v6 (`/switch`) argument parser. Removed in a future release. |
143172
| `GITVERSION_REMOTE_USERNAME` | Alternative to `--username` for dynamic-repository credentials. |
144173
| `GITVERSION_REMOTE_PASSWORD` | Alternative to `--password` for dynamic-repository credentials. |

docs/input/docs/reference/build-servers/gitlab.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ After repository normalisation the friendly branch name becomes
2929
GitLab's namespace (the default `pull-requests|pull|pr` pattern does not):
3030

3131
```yaml
32-
workflow: GitFlow/v1
33-
branches:
34-
pull-request:
35-
regex: ^merge-requests/(?<Number>\d+)/(head|merge)$
36-
label: PullRequest{Number}
32+
calculation:
33+
branches:
34+
pull-request:
35+
label: PullRequest{Number}
36+
regex: ^merge-requests/(?<Number>\d+)/(head|merge)$
37+
workflow: GitFlow/v1
3738
```
3839
3940
`CI_COMMIT_REF_NAME` still contains the source branch name (for example

0 commit comments

Comments
 (0)