Skip to content

Commit

Permalink
GitTools#1054 - renamed tag => label
Browse files Browse the repository at this point in the history
tag-pre-release-weight, tag-prefix, continuous-delivery-fallback-tag, tag-number-pattern, tag
  • Loading branch information
arturcic committed Dec 19, 2022
1 parent 321a97e commit ef7aec5
Show file tree
Hide file tree
Showing 43 changed files with 269 additions and 269 deletions.
2 changes: 1 addition & 1 deletion BREAKING_CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Unreleased

* The configuration properties tag-* or *-tag were renamed to label-* or *-label (tag-pre-release-weight, tag-prefix, continuous-delivery-fallback-tag, tag-number-pattern, tag)
* When using a commit message that matches **both** `*-version-bump-message` and `no-bump-message`, there is no increment for that commit. In other words, `no-bump-message` now takes precedence over `*-version-bump-message`.
* The fallback version strategy now returns `0.0.0` and is flagged with `ShouldIncrement` equal to `true`. This yields the version `0.1.0` on the `develop` branch (`IncrementStrategy.Minor` by default) and `0.0.1` on the `main` branch (`IncremetnStrategy.Patch` by default).
* The current branch (child) inherits its configuration from the source (parent) branch if the `increment` strategy is set to `Inherit`. This makes branch configuration recursive, simpler, more intuitive, more flexible, and more robust.
Expand Down
56 changes: 28 additions & 28 deletions docs/input/docs/reference/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ assembly-file-versioning-scheme: MajorMinorPatch
assembly-informational-format: '{InformationalVersion}'
mode: ContinuousDelivery
increment: Inherit
continuous-delivery-fallback-tag: ci
tag-prefix: '[vV]'
continuous-delivery-fallback-label: ci
label-prefix: '[vV]'
major-version-bump-message: '\+semver:\s?(breaking|major)'
minor-version-bump-message: '\+semver:\s?(feature|minor)'
patch-version-bump-message: '\+semver:\s?(fix|patch)'
no-bump-message: '\+semver:\s?(none|skip)'
tag-pre-release-weight: 60000
label-pre-release-weight: 60000
commit-message-incrementing: Enabled
ignore:
sha: []
Expand Down Expand Up @@ -142,26 +142,26 @@ for [increment](#increment),
[prevent-increment-of-merged-branch-version](#prevent-increment-of-merged-branch-version)
and [tracks-release-branches](#tracks-release-branches).

### continuous-delivery-fallback-tag
### continuous-delivery-fallback-label

When using `mode: ContinuousDeployment`, the value specified in
`continuous-delivery-fallback-tag` will be used as the pre-release tag for
`continuous-delivery-fallback-label` will be used as the pre-release label for
branches which do not have one specified. Default set to `ci`.

Just to clarify: For a build name without `...-ci-<buildnumber>` or in other
words without a `PreReleaseTag` (ergo `"PreReleaseTag":""` in GitVersion's JSON output)
at the end you would need to set `continuous-delivery-fallback-tag` to an empty
at the end you would need to set `continuous-delivery-fallback-label` to an empty
string (`''`):

```yaml
mode: ContinuousDeployment
continuous-delivery-fallback-tag: ''
continuous-delivery-fallback-label: ''
...
```

Doing so can be helpful if you use your `main` branch as a `release` branch.

### tag-prefix
### label-prefix

A regex which is used to trim Git tags before processing (e.g., v1.0.0). Default
is `[vV]`, although this is just for illustrative purposes as we do a IgnoreCase
Expand Down Expand Up @@ -194,7 +194,7 @@ none` and `+semver: skip`
When a commit matches **both** the `no-bump-message` **and** any combination of
the `version-bump-message`, `no-bump-message` takes precedence and no increment is applied.

### tag-pre-release-weight
### label-pre-release-weight

The pre-release weight in case of tagged commits. If the value is not set in the
configuration, a default weight of 60000 is used instead. If the
Expand Down Expand Up @@ -293,7 +293,7 @@ branches:
main:
regex: ^master$|^main$
mode: ContinuousDelivery
tag: ''
label: ''
increment: Patch
prevent-increment-of-merged-branch-version: true
track-merge-target: false
Expand All @@ -305,7 +305,7 @@ branches:
develop:
regex: ^dev(elop)?(ment)?$
mode: ContinuousDeployment
tag: alpha
label: alpha
increment: Minor
prevent-increment-of-merged-branch-version: false
track-merge-target: true
Expand All @@ -317,7 +317,7 @@ branches:
release:
regex: ^releases?[/-]
mode: ContinuousDelivery
tag: beta
label: beta
increment: None
prevent-increment-of-merged-branch-version: true
track-merge-target: false
Expand All @@ -329,29 +329,29 @@ branches:
feature:
regex: ^features?[/-]
mode: ContinuousDelivery
tag: '{BranchName}'
label: '{BranchName}'
increment: Inherit
source-branches: [ 'develop', 'main', 'release', 'feature', 'support', 'hotfix' ]
pre-release-weight: 30000
pre-release-weight: 30000
pull-request:
regex: ^(pull|pull\-requests|pr)[/-]
mode: ContinuousDelivery
tag: PullRequest
label: PullRequest
increment: Inherit
tag-number-pattern: '[/-](?<number>\d+)[-/]'
label-number-pattern: '[/-](?<number>\d+)[-/]'
source-branches: [ 'develop', 'main', 'release', 'feature', 'support', 'hotfix' ]
pre-release-weight: 30000
hotfix:
regex: ^hotfix(es)?[/-]
mode: ContinuousDelivery
tag: beta
label: beta
increment: Inherit
source-branches: [ 'release', 'main', 'support', 'hotfix' ]
pre-release-weight: 30000
support:
regex: ^support[/-]
mode: ContinuousDelivery
tag: ''
label: ''
increment: Patch
prevent-increment-of-merged-branch-version: true
track-merge-target: false
Expand Down Expand Up @@ -457,15 +457,15 @@ The header for all the individual branch configuration.

Same as for the [global configuration, explained above](#mode).

### tag
### label

The pre release tag to use for this branch. Use the value `useBranchName` to use
The pre release label to use for this branch. Use the value `useBranchName` to use
the branch name instead. For example `feature/foo` would become a pre-release
tag of `foo` with this value. Use the value `{BranchName}` as a placeholder to
insert the branch name. For example `feature/foo` would become a pre-release tag
label of `foo` with this value. Use the value `{BranchName}` as a placeholder to
insert the branch name. For example `feature/foo` would become a pre-release label
of `alpha.foo` with the value of `alpha.{BranchName}`.

**Note:** To clear a default use an empty string: `tag: ''`
**Note:** To clear a default use an empty string: `label: ''`

### increment

Expand All @@ -482,15 +482,15 @@ In a GitFlow-based repository, setting this option can have implications on the
better version source proposed by the `MergeMessageBaseVersionStrategy`. For
more details and an in-depth analysis, please see [the discussion][2506].

### tag-number-pattern
### label-number-pattern

Pull requests require us to extract the pre-release number out of the branch
name so `refs/pulls/534/merge` builds as `PullRequest.534`. This is a regex with
a named capture group called `number`.

If the branch `mode` is set to `ContinuousDeployment`, then the extracted
`number` is appended to the name of the pre-release tag and the number portion
is the number of commits since the last tag. This enables consecutive commits to
`number` is appended to the name of the pre-release label and the number portion
is the number of commits since the last label. This enables consecutive commits to
the pull request branch to generate unique full semantic version numbers when
the branch is configured to use ContinuousDeployment mode.

Expand All @@ -500,10 +500,10 @@ the branch is configured to use ContinuousDeployment mode.
branches:
pull-request:
mode: ContinuousDeployment
tag: PullRequest
label: PullRequest
increment: Inherit
track-merge-target: true
tag-number-pattern: '[/-](?<number>\d+)[-/]'
label-number-pattern: '[/-](?<number>\d+)[-/]'
```

### track-merge-target
Expand Down
16 changes: 8 additions & 8 deletions docs/input/docs/usage/cli/arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ GitVersion [path]
from GitVersion.yml) in yaml format
/overrideconfig Overrides GitVersion config values inline (semicolon-
separated key value pairs e.g. /overrideconfig
tag-prefix=Foo)
Currently supported config overrides: tag-prefix
label-prefix=Foo)
Currently supported config overrides: label-prefix
/nocache Bypasses the cache, result will not be written to the cache.
/nonormalize Disables normalize step on a build server.
/verbosity Specifies the amount of information to be displayed.
Expand Down Expand Up @@ -117,25 +117,25 @@ Following options are supported:
5. `assembly-versioning-scheme`
7. `commit-date-format`
8. `commit-message-incrementing`
10. `continuous-delivery-fallback-tag`
10. `continuous-delivery-fallback-label`
11. `increment`
13. `major-version-bump-message`
14. `minor-version-bump-message`
15. `mode`
16. `next-version`
17. `no-bump-message`
18. `patch-version-bump-message`
19. `tag-prefix`
20. `tag-pre-release-weight`
19. `label-prefix`
20. `label-pre-release-weight`
21. `update-build-number`
Read more about [Configuration](/docs/reference/configuration).
Using `override-config` on the command line will not change the contents of the config file `GitVersion.yml`.
### Example: How to override configuration option 'tag-prefix' to use prefix 'custom'
### Example: How to override configuration option 'label-prefix' to use prefix 'custom'
`GitVersion.exe /output json /overrideconfig tag-prefix=custom`
`GitVersion.exe /output json /overrideconfig label-prefix=custom`
### Example: How to override configuration option 'assembly-versioning-format'
Expand All @@ -151,7 +151,7 @@ Will use only major and minor version numbers for assembly version. Assembly bui
### Example: How to override multiple configuration options
`GitVersion.exe /output json /overrideconfig tag-prefix=custom /overrideconfig assembly-versioning-scheme=MajorMinor`
`GitVersion.exe /output json /overrideconfig label-prefix=custom /overrideconfig assembly-versioning-scheme=MajorMinor`
### Example: How to override configuration option 'update-build-number'
Expand Down
4 changes: 2 additions & 2 deletions docs/input/docs/usage/cli/assembly-patch.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ Will result in command line argument error
Will iterate through each file and update known attributes (`AssemblyVersion`,
`AssemblyFileVersion`, `AssemblyInformationalVersion`).

## Example: How to override configuration option 'tag-prefix' to use prefix 'custom'
## Example: How to override configuration option 'label-prefix' to use prefix 'custom'

`GitVersion.exe /output json /overrideconfig tag-prefix=custom`
`GitVersion.exe /output json /overrideconfig label-prefix=custom`

## Writing version metadata in WiX format

Expand Down
40 changes: 20 additions & 20 deletions src/GitVersion.App.Tests/ArgumentParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,9 @@ public string OverrideconfigWithInvalidOption(string options)

private static IEnumerable<TestCaseData> OverrideconfigWithInvalidOptionTestData()
{
yield return new TestCaseData("tag-prefix=sample=asdf")
yield return new TestCaseData("label-prefix=sample=asdf")
{
ExpectedResult = "Could not parse /overrideconfig option: tag-prefix=sample=asdf. Ensure it is in format 'key=value'."
ExpectedResult = "Could not parse /overrideconfig option: label-prefix=sample=asdf. Ensure it is in format 'key=value'."
};
yield return new TestCaseData("unknown-option=25")
{
Expand All @@ -393,9 +393,9 @@ private static IEnumerable<TestCaseData> OverrideconfigWithInvalidOptionTestData
{
ExpectedResult = "Could not parse /overrideconfig option: update-build-number=1. Ensure that 'value' is 'true' or 'false'."
};
yield return new TestCaseData("tag-pre-release-weight=invalid-value")
yield return new TestCaseData("label-pre-release-weight=invalid-value")
{
ExpectedResult = "Could not parse /overrideconfig option: tag-pre-release-weight=invalid-value. Ensure that 'value' is valid integer number."
ExpectedResult = "Could not parse /overrideconfig option: label-pre-release-weight=invalid-value. Ensure that 'value' is valid integer number."
};
yield return new TestCaseData("assembly-versioning-scheme=WrongEnumValue")
{
Expand Down Expand Up @@ -460,17 +460,17 @@ private static IEnumerable<TestCaseData> OverrideConfigWithSingleOptionTestData(
}
);
yield return new TestCaseData(
"tag-prefix=sample",
"label-prefix=sample",
new GitVersionConfiguration
{
TagPrefix = "sample"
LabelPrefix = "sample"
}
);
yield return new TestCaseData(
"continuous-delivery-fallback-tag=cd-tag",
"continuous-delivery-fallback-label=cd-label",
new GitVersionConfiguration
{
ContinuousDeploymentFallbackTag = "cd-tag"
ContinuousDeploymentFallbackLabel = "cd-label"
}
);
yield return new TestCaseData(
Expand Down Expand Up @@ -509,10 +509,10 @@ private static IEnumerable<TestCaseData> OverrideConfigWithSingleOptionTestData(
}
);
yield return new TestCaseData(
"tag-pre-release-weight=2",
"label-pre-release-weight=2",
new GitVersionConfiguration
{
TagPreReleaseWeight = 2
LabelPreReleaseWeight = 2
}
);
yield return new TestCaseData(
Expand Down Expand Up @@ -545,41 +545,41 @@ private static IEnumerable<TestCaseData> OverrideConfigWithSingleOptionTestData(
);
}

[TestCaseSource(nameof(OverrideconfigWithMultipleOptionsTestData))]
public void OverrideconfigWithMultipleOptions(string options, GitVersionConfiguration expected)
[TestCaseSource(nameof(OverrideConfigWithMultipleOptionsTestData))]
public void OverrideConfigWithMultipleOptions(string options, GitVersionConfiguration expected)
{
var arguments = this.argumentParser.ParseArguments(options);
arguments.OverrideConfig.ShouldBeEquivalentTo(expected);
}

private static IEnumerable<TestCaseData> OverrideconfigWithMultipleOptionsTestData()
private static IEnumerable<TestCaseData> OverrideConfigWithMultipleOptionsTestData()
{
yield return new TestCaseData(
"/overrideconfig tag-prefix=sample /overrideconfig assembly-versioning-scheme=MajorMinor",
"/overrideconfig label-prefix=sample /overrideconfig assembly-versioning-scheme=MajorMinor",
new GitVersionConfiguration
{
TagPrefix = "sample",
LabelPrefix = "sample",
AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinor
}
);
yield return new TestCaseData(
"/overrideconfig tag-prefix=sample /overrideconfig assembly-versioning-format=\"{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}\"",
"/overrideconfig label-prefix=sample /overrideconfig assembly-versioning-format=\"{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}\"",
new GitVersionConfiguration
{
TagPrefix = "sample",
LabelPrefix = "sample",
AssemblyVersioningFormat = "{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}"
}
);
yield return new TestCaseData(
"/overrideconfig tag-prefix=sample /overrideconfig assembly-versioning-format=\"{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}\" /overrideconfig update-build-number=true /overrideconfig assembly-versioning-scheme=MajorMinorPatchTag /overrideconfig mode=ContinuousDelivery /overrideconfig tag-pre-release-weight=4",
"/overrideconfig label-prefix=sample /overrideconfig assembly-versioning-format=\"{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}\" /overrideconfig update-build-number=true /overrideconfig assembly-versioning-scheme=MajorMinorPatchTag /overrideconfig mode=ContinuousDelivery /overrideconfig label-pre-release-weight=4",
new GitVersionConfiguration
{
TagPrefix = "sample",
LabelPrefix = "sample",
AssemblyVersioningFormat = "{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}",
UpdateBuildNumber = true,
AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatchTag,
VersioningMode = VersioningMode.ContinuousDelivery,
TagPreReleaseWeight = 4
LabelPreReleaseWeight = 4
}
);
}
Expand Down
Loading

0 comments on commit ef7aec5

Please sign in to comment.