Skip to content

Commit 1ae5536

Browse files
authored
Merge pull request #3882 from HHobeck/feature/Replace-the-version-mode-Mainline-Part-III
Replace the version mode Mainline in 6.x (Part III)
2 parents 6ae42cb + 434189a commit 1ae5536

38 files changed

+201
-196
lines changed

BREAKING_CHANGES.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@
3333
* Default `RegularExpression` for feature branches is changed from `^features?[/-]` to `^features?[/-](?<BranchName>.+)` to support using `{BranchName}` out-of-the-box
3434
* Default `RegularExpression` for unknown branches is changed from `.*` to `(?<BranchName>.*)` to support using `{BranchName}` out-of-the-box
3535
* The branch related property `is-mainline` in the configuration system has been renamed to `is-main-branch`
36-
36+
* The versioning mode has been renamed to deployment mode and consists of following values:
37+
* ManualDeployment (previously ContinuousDelivery)
38+
* ContinuousDelivery (previously ContinuousDeployment)
39+
* ContinuousDeployment (new)
40+
3741
## v5.0.0
3842
3943
* Version numbers in branches other than `release` branches are no longer

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ We can then customize the configuration by chaining methods of the builder. At t
5252
For example:
5353
```csharp
5454
var configuration = configurationBuilder
55-
.WithVersioningMode(VersioningMode.ContinuousDeployment)
55+
.WithDeploymentMode(DeploymentMode.ContinuousDeployment)
5656
.WithNextVersion("1.0.0")
5757
.Build();
5858
```

build/build/Tasks/Test/UnitTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public override void OnError(Exception exception, BuildContext context)
4848
public override void Finally(BuildContext context)
4949
{
5050
var testResultsFiles = context.GetFiles($"{Paths.TestOutput}/*.results.xml");
51-
if (!context.IsAzurePipelineBuild || !testResultsFiles.Any()) return;
51+
if (!context.IsAzurePipelineBuild || testResultsFiles.Count == 0) return;
5252

5353
var data = new AzurePipelinesPublishTestResultsData
5454
{

build/common/Utilities/Extensions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static string GetTaskArguments(this Type task)
3838
}
3939

4040
var attributes = task.GetCustomAttributes<TaskArgumentAttribute>().ToArray();
41-
if (attributes.Any())
41+
if (attributes.Length != 0)
4242
{
4343
var arguments = attributes.Select(attribute => $"[--{attribute.Name} ({string.Join(" | ", attribute.PossibleValues)})]");
4444
return string.Join(" ", arguments);

schemas/6.0/GitVersion.configuration.json

+16-15
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@
5555
"commit-message-incrementing": {
5656
"$ref": "#/$defs/nullableOfCommitMessageIncrementMode"
5757
},
58+
"mode": {
59+
"$ref": "#/$defs/nullableOfDeploymentMode"
60+
},
5861
"ignore": {
5962
"description": "The header property for the ignore configuration.",
6063
"type": "object",
@@ -173,9 +176,6 @@
173176
"default": "(?<version>[vV]?\\d+(\\.\\d+)?(\\.\\d+)?).*",
174177
"type": "string"
175178
},
176-
"mode": {
177-
"$ref": "#/$defs/nullableOfVersioningMode"
178-
},
179179
"workflow": {
180180
"description": "The base template of the configuration to use. Possible values are: 'GitFlow/v1' or 'GitHubFlow/v1'",
181181
"type": "string"
@@ -188,6 +188,9 @@
188188
"commit-message-incrementing": {
189189
"$ref": "#/$defs/nullableOfCommitMessageIncrementMode"
190190
},
191+
"mode": {
192+
"$ref": "#/$defs/nullableOfDeploymentMode"
193+
},
191194
"increment": {
192195
"$ref": "#/$defs/incrementStrategy"
193196
},
@@ -226,9 +229,6 @@
226229
},
227230
"tracks-release-branches": {
228231
"$ref": "#/$defs/nullableOfBoolean5"
229-
},
230-
"mode": {
231-
"$ref": "#/$defs/nullableOfVersioningMode"
232232
}
233233
}
234234
},
@@ -240,6 +240,15 @@
240240
"MergeMessageOnly"
241241
]
242242
},
243+
"nullableOfDeploymentMode": {
244+
"description": "The deployment mode for this branch. Can be 'ManualDeployment', 'ContinuousDelivery', 'ContinuousDeployment'.",
245+
"enum": [
246+
"ManualDeployment",
247+
"ContinuousDelivery",
248+
"ContinuousDeployment",
249+
"TrunkBased"
250+
]
251+
},
243252
"incrementStrategy": {
244253
"description": "The increment strategy for this branch. Can be 'Inherit', 'Patch', 'Minor', 'Major', 'None'.",
245254
"enum": [
@@ -330,14 +339,6 @@
330339
"null"
331340
]
332341
},
333-
"nullableOfVersioningMode": {
334-
"description": "The versioning mode for this branch. Can be 'ContinuousDelivery', 'ContinuousDeployment', 'Mainline'.",
335-
"enum": [
336-
"ContinuousDelivery",
337-
"ContinuousDeployment",
338-
"Mainline"
339-
]
340-
},
341342
"string3": {
342343
"format": "date-time",
343344
"description": "Commits before this date will be ignored. Format: yyyy-MM-ddTHH:mm:ss.",
@@ -352,4 +353,4 @@
352353
}
353354
}
354355
}
355-
}
356+
}

src/GitVersion.App.Tests/ArgumentParserTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ private static IEnumerable<TestCaseData> OverrideConfigWithSingleOptionTestData(
444444
"mode=ContinuousDelivery",
445445
new GitVersionConfiguration
446446
{
447-
VersioningMode = VersioningMode.ContinuousDelivery
447+
DeploymentMode = DeploymentMode.ContinuousDelivery
448448
}
449449
);
450450
yield return new TestCaseData(
@@ -567,7 +567,7 @@ private static IEnumerable<TestCaseData> OverrideConfigWithMultipleOptionsTestDa
567567
AssemblyVersioningFormat = "{Major}.{Minor}.{Patch}.{env:CI_JOB_ID ?? 0}",
568568
UpdateBuildNumber = true,
569569
AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatchTag,
570-
VersioningMode = VersioningMode.ContinuousDelivery,
570+
DeploymentMode = DeploymentMode.ContinuousDelivery,
571571
TagPreReleaseWeight = 4
572572
}
573573
);

src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ public void OverwritesDefaultsWithProvidedConfig()
5151
var developConfiguration = configuration.Branches["develop"];
5252
developConfiguration.Increment.ShouldBe(IncrementStrategy.Major);
5353
developConfiguration.Increment.ShouldNotBe(defaultConfiguration.Branches["develop"].Increment);
54-
developConfiguration.VersioningMode.ShouldBe(VersioningMode.ContinuousDelivery);
55-
developConfiguration.VersioningMode.ShouldNotBe(defaultConfiguration.Branches["develop"].VersioningMode);
54+
developConfiguration.DeploymentMode.ShouldBe(DeploymentMode.ContinuousDelivery);
55+
developConfiguration.DeploymentMode.ShouldNotBe(defaultConfiguration.Branches["develop"].DeploymentMode);
5656
developConfiguration.Label.ShouldBe("dev");
5757
}
5858

src/GitVersion.Configuration/BranchConfiguration.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ namespace GitVersion.Configuration;
77
internal record BranchConfiguration : IBranchConfiguration
88
{
99
[JsonPropertyName("mode")]
10-
[JsonPropertyDescription("The versioning mode for this branch. Can be 'ContinuousDelivery', 'ContinuousDeployment', 'Mainline'.")]
11-
public VersioningMode? VersioningMode { get; internal set; }
10+
[JsonPropertyDescription("The deployment mode for this branch. Can be 'ManualDeployment', 'ContinuousDelivery', 'ContinuousDeployment'.")]
11+
public DeploymentMode? DeploymentMode { get; internal set; }
1212

1313
[JsonPropertyName("label")]
1414
[JsonPropertyDescription("The label to use for this branch. Use the value {BranchName} or similar as a placeholder to insert a named capture group from RegularExpression (fx. the branch name).")]
@@ -85,7 +85,7 @@ public virtual IBranchConfiguration Inherit(IBranchConfiguration configuration)
8585
return new BranchConfiguration(this)
8686
{
8787
Increment = Increment == IncrementStrategy.Inherit ? configuration.Increment : Increment,
88-
VersioningMode = VersioningMode ?? configuration.VersioningMode,
88+
DeploymentMode = DeploymentMode ?? configuration.DeploymentMode,
8989
Label = Label ?? configuration.Label,
9090
PreventIncrementOfMergedBranchVersion = PreventIncrementOfMergedBranchVersion
9191
?? configuration.PreventIncrementOfMergedBranchVersion,

src/GitVersion.Configuration/BranchConfigurationBuilder.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ internal class BranchConfigurationBuilder
66
{
77
public static BranchConfigurationBuilder New => new();
88

9-
private VersioningMode? versioningMode;
9+
private DeploymentMode? deploymentMode;
1010
private string? label;
1111
private IncrementStrategy increment;
1212
private bool? preventIncrementOfMergedBranchVersion;
@@ -26,9 +26,9 @@ private BranchConfigurationBuilder()
2626
{
2727
}
2828

29-
public virtual BranchConfigurationBuilder WithVersioningMode(VersioningMode? value)
29+
public virtual BranchConfigurationBuilder WithDeploymentMode(DeploymentMode? value)
3030
{
31-
this.versioningMode = value;
31+
this.deploymentMode = value;
3232
return this;
3333
}
3434

@@ -130,7 +130,7 @@ public virtual BranchConfigurationBuilder WithPreReleaseWeight(int? value)
130130

131131
public virtual BranchConfigurationBuilder WithConfiguration(IBranchConfiguration value)
132132
{
133-
WithVersioningMode(value.VersioningMode);
133+
WithDeploymentMode(value.DeploymentMode);
134134
WithLabel(value.Label);
135135
WithIncrement(value.Increment);
136136
WithPreventIncrementOfMergedBranchVersion(value.PreventIncrementOfMergedBranchVersion);
@@ -150,7 +150,7 @@ public virtual BranchConfigurationBuilder WithConfiguration(IBranchConfiguration
150150

151151
public IBranchConfiguration Build() => new BranchConfiguration
152152
{
153-
VersioningMode = versioningMode,
153+
DeploymentMode = deploymentMode,
154154
Label = label,
155155
Increment = increment,
156156
RegularExpression = regularExpression,

src/GitVersion.Configuration/ConfigurationBuilderBase.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ internal abstract class ConfigurationBuilderBase<TConfigurationBuilder> : IConfi
2727
private Dictionary<string, string> mergeMessageFormats = new();
2828
private readonly List<IReadOnlyDictionary<object, object?>> overrides = new();
2929
private readonly Dictionary<string, BranchConfigurationBuilder> branchConfigurationBuilders = new();
30-
private VersioningMode? versioningMode;
30+
private DeploymentMode? versioningMode;
3131
private string? label;
3232
private IncrementStrategy increment = IncrementStrategy.Inherit;
3333
private bool? preventIncrementOfMergedBranchVersion;
@@ -224,7 +224,7 @@ public virtual TConfigurationBuilder WithBranch(string value, Action<BranchConfi
224224
return (TConfigurationBuilder)this;
225225
}
226226

227-
public virtual TConfigurationBuilder WithVersioningMode(VersioningMode? value)
227+
public virtual TConfigurationBuilder WithDeploymentMode(DeploymentMode? value)
228228
{
229229
this.versioningMode = value;
230230
return (TConfigurationBuilder)this;
@@ -326,7 +326,7 @@ public virtual TConfigurationBuilder WithConfiguration(IGitVersionConfiguration
326326
{
327327
WithBranch(name).WithConfiguration(branchConfiguration);
328328
}
329-
WithVersioningMode(value.VersioningMode);
329+
WithDeploymentMode(value.DeploymentMode);
330330
WithLabel(value.Label);
331331
WithIncrement(value.Increment);
332332
WithPreventIncrementOfMergedBranchVersion(value.PreventIncrementOfMergedBranchVersion);
@@ -379,7 +379,7 @@ public virtual IGitVersionConfiguration Build()
379379
SemanticVersionFormat = this.semanticVersionFormat,
380380
Branches = branches,
381381
MergeMessageFormats = this.mergeMessageFormats,
382-
VersioningMode = this.versioningMode,
382+
DeploymentMode = this.versioningMode,
383383
Label = this.label,
384384
Increment = this.increment,
385385
RegularExpression = this.regularExpression,

src/GitVersion.Configuration/ConfigurationFileLocator.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ bool HasConfigurationFileAt(string fileName, out string? configFile)
6767
private static void VerifyReadConfig(IGitVersionConfiguration configuration)
6868
{
6969
// Verify no branches are set to TrunkBased mode
70-
if (configuration.Branches.Any(b => b.Value.VersioningMode == VersioningMode.TrunkBased))
70+
if (configuration.Branches.Any(b => b.Value.DeploymentMode == DeploymentMode.TrunkBased))
7171
{
7272
throw new ConfigurationException(@"TrunkBased mode only works at the repository level, a single branch cannot be put into TrunkBased mode
7373

src/GitVersion.Configuration/GitFlowConfigurationBuilder.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ private GitFlowConfigurationBuilder()
2222
VersionInBranchPattern = ConfigurationConstants.DefaultVersionInBranchPattern,
2323
TagPreReleaseWeight = ConfigurationConstants.DefaultTagPreReleaseWeight,
2424
UpdateBuildNumber = ConfigurationConstants.DefaultUpdateBuildNumber,
25-
VersioningMode = VersioningMode.ContinuousDelivery,
25+
DeploymentMode = DeploymentMode.ContinuousDelivery,
2626
RegularExpression = string.Empty,
2727
Label = ConfigurationConstants.BranchNamePlaceholder,
2828
Increment = IncrementStrategy.Inherit,
@@ -70,7 +70,7 @@ private GitFlowConfigurationBuilder()
7070
WithBranch(ReleaseBranch.Name).WithConfiguration(new BranchConfiguration
7171
{
7272
Increment = IncrementStrategy.None,
73-
VersioningMode = VersioningMode.ManualDeployment,
73+
DeploymentMode = DeploymentMode.ManualDeployment,
7474
RegularExpression = ReleaseBranch.RegexPattern,
7575
SourceBranches =
7676
[
@@ -92,7 +92,7 @@ private GitFlowConfigurationBuilder()
9292
{
9393
Increment = IncrementStrategy.Inherit,
9494
RegularExpression = FeatureBranch.RegexPattern,
95-
VersioningMode = VersioningMode.ManualDeployment,
95+
DeploymentMode = DeploymentMode.ManualDeployment,
9696
SourceBranches =
9797
[
9898
this.DevelopBranch.Name,
@@ -110,7 +110,7 @@ private GitFlowConfigurationBuilder()
110110
{
111111
Increment = IncrementStrategy.Inherit,
112112
RegularExpression = PullRequestBranch.RegexPattern,
113-
VersioningMode = VersioningMode.ContinuousDelivery,
113+
DeploymentMode = DeploymentMode.ContinuousDelivery,
114114
SourceBranches =
115115
[
116116
this.DevelopBranch.Name,
@@ -129,7 +129,7 @@ private GitFlowConfigurationBuilder()
129129
{
130130
Increment = IncrementStrategy.Inherit,
131131
RegularExpression = HotfixBranch.RegexPattern,
132-
VersioningMode = VersioningMode.ManualDeployment,
132+
DeploymentMode = DeploymentMode.ManualDeployment,
133133
SourceBranches =
134134
[
135135
this.ReleaseBranch.Name,
@@ -160,7 +160,7 @@ private GitFlowConfigurationBuilder()
160160
{
161161
RegularExpression = UnknownBranch.RegexPattern,
162162
Label = ConfigurationConstants.BranchNamePlaceholder,
163-
VersioningMode = VersioningMode.ManualDeployment,
163+
DeploymentMode = DeploymentMode.ManualDeployment,
164164
Increment = IncrementStrategy.Inherit,
165165
SourceBranches =
166166
[

src/GitVersion.Configuration/GitHubFlowConfigurationBuilder.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ private GitHubFlowConfigurationBuilder()
2222
VersionInBranchPattern = ConfigurationConstants.DefaultVersionInBranchPattern,
2323
TagPreReleaseWeight = ConfigurationConstants.DefaultTagPreReleaseWeight,
2424
UpdateBuildNumber = ConfigurationConstants.DefaultUpdateBuildNumber,
25-
VersioningMode = VersioningMode.ContinuousDelivery,
25+
DeploymentMode = DeploymentMode.ContinuousDelivery,
2626
RegularExpression = string.Empty,
2727
Label = ConfigurationConstants.BranchNamePlaceholder,
2828
Increment = IncrementStrategy.Inherit,
@@ -53,7 +53,7 @@ private GitHubFlowConfigurationBuilder()
5353
{
5454
Increment = IncrementStrategy.None,
5555
RegularExpression = ReleaseBranch.RegexPattern,
56-
VersioningMode = VersioningMode.ManualDeployment,
56+
DeploymentMode = DeploymentMode.ManualDeployment,
5757
SourceBranches =
5858
[
5959
this.MainBranch.Name,
@@ -72,7 +72,7 @@ private GitHubFlowConfigurationBuilder()
7272
{
7373
Increment = IncrementStrategy.Inherit,
7474
RegularExpression = FeatureBranch.RegexPattern,
75-
VersioningMode = VersioningMode.ManualDeployment,
75+
DeploymentMode = DeploymentMode.ManualDeployment,
7676
SourceBranches =
7777
[
7878
this.MainBranch.Name,
@@ -87,7 +87,7 @@ private GitHubFlowConfigurationBuilder()
8787
{
8888
Increment = IncrementStrategy.Inherit,
8989
RegularExpression = PullRequestBranch.RegexPattern,
90-
VersioningMode = VersioningMode.ContinuousDelivery,
90+
DeploymentMode = DeploymentMode.ContinuousDelivery,
9191
SourceBranches =
9292
[
9393
this.MainBranch.Name,
@@ -103,7 +103,7 @@ private GitHubFlowConfigurationBuilder()
103103
{
104104
RegularExpression = UnknownBranch.RegexPattern,
105105
Label = ConfigurationConstants.BranchNamePlaceholder,
106-
VersioningMode = VersioningMode.ManualDeployment,
106+
DeploymentMode = DeploymentMode.ManualDeployment,
107107
Increment = IncrementStrategy.Inherit,
108108
SourceBranches =
109109
[

src/GitVersion.Configuration/Init/EditConfigStep.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ protected override string GetPrompt(ConfigurationBuilder configurationBuilder, s
5555
5656
3) Set next version number
5757
4) Branch specific configuration
58-
5) Branch Increment mode (per commit/after tag) (Current: {configuration.VersioningMode ?? VersioningMode.ContinuousDeployment})
58+
5) Branch Increment mode (per commit/after tag) (Current: {configuration.DeploymentMode ?? DeploymentMode.ContinuousDeployment})
5959
6) Assembly versioning scheme (Current: {configuration.AssemblyVersioningScheme})
6060
7) Setup build scripts";
6161
}

src/GitVersion.Configuration/Init/SetConfig/ConfigureBranch.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected override string GetPrompt(ConfigurationBuilder configurationBuilder, s
4141
4242
0) Go Back
4343
1) Branch Pr-release tag (Current: {branchConfiguration.Label})
44-
2) Branch Increment mode (per commit/after tag) (Current: {branchConfiguration.VersioningMode})";
44+
2) Branch Increment mode (per commit/after tag) (Current: {branchConfiguration.DeploymentMode})";
4545
}
4646

4747
protected override string DefaultResult => "0";

src/GitVersion.Configuration/Init/SetConfig/GlobalModeSetting.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ protected override StepResult HandleResult(
2323
switch (result)
2424
{
2525
case "1":
26-
configurationBuilder.WithVersioningMode(VersioningMode.ContinuousDelivery);
26+
configurationBuilder.WithDeploymentMode(DeploymentMode.ContinuousDelivery);
2727
steps.Enqueue(this.returnToStep);
2828
return StepResult.Ok();
2929
case "2":
30-
configurationBuilder.WithVersioningMode(VersioningMode.ContinuousDeployment);
30+
configurationBuilder.WithDeploymentMode(DeploymentMode.ContinuousDeployment);
3131
steps.Enqueue(this.returnToStep);
3232
return StepResult.Ok();
3333
case "3":
34-
configurationBuilder.WithVersioningMode(VersioningMode.TrunkBased);
34+
configurationBuilder.WithDeploymentMode(DeploymentMode.TrunkBased);
3535
steps.Enqueue(this.returnToStep);
3636
return StepResult.Ok();
3737
case "0":

0 commit comments

Comments
 (0)