Allow use of features and hotfixes with mainline mode #2480
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See #2479 for detailed description of issue.
This PR allows the use of feature/hotfix branch pre-release builds when using mainline mode. Previously this was throwing an exception with message "Mainline development mode doesn't yet support pre-release tags on master". This would occur after the following steps:
Description
After getting the base versions in
BaseVersionCalculator.GetBaseVersion()
, check if the configured versioning mode is mainline, if it is then filter out pre-release versions frombaseVersions
list before proceeding.Related Issue
#2479
Motivation and Context
I'm trying to achieve the following:
Versioning NuGet packages using GitVersion. I do not intend to use develop or release branches because it's just overkill for me and my team and would frankly just be a waste of time and effort.
We want to be able to use master as our released branch. Versions on the master branch will always be format {major}.{minor}.{patch}. We would like to use feature branches for new functionality and would like feature branches to also trigger package builds but of a pre-release format such as {major}.{minor}.{patch}-{tag}.{number}. Feature branches merged into master would increment the minor version automatically. Finally, we would like to use hotfix branches for bug fixes. Hotfixes builds would have the same pre-release format as feature branches but when they're merged into master, they'd increment the patch version.
I have tried using both Mainline and Continuous Deployment modes to achieve this but both have failed me so far. I might just be doing something wrong so please advise as to whether this is possible and how.
The documentation shows that my desired outcome should indeed be possible with mainline mode, however this does not seem to be the case in reality.
The documentation contains a graphic which begins like this:
Firstly, this shows that a feature branch has been tagged with 1.0.1-foo.1+1. The current mainline functionality creates a tag with name 1.0.1-foo.1 (missing the +1). Is this documentation just old? Has the +1 part been removed now?
Secondly, the diagram shows that once the feature branch is merged into master, master is then tagged with 1.0.1 (same issue with +2). This is not the case, GitVersion outputs version 1.0.1-foo.2 for me.
How Has This Been Tested?
Added new tests to cover new scenarios and also ensured all existing tests still pass successfully.
Checklist: