[ISSUE]: Regex Capture Groups don't work correctly on release branch.
Prerequisites
- [X] I have written a descriptive issue title
- [X] I have searched issues to ensure it has not already been reported
GitVersion package
GitVersion.Tool
GitVersion version
6.0.0-beta.7-alpine.3.18-7.0
Operating system
Linux
What are you seeing?
I am seeing GitVersion not properly do regex capture grouping and returning invalid versions/labels.
Example:
GitVersion_SemVer=0.2.0-beta{SubBranchName}.1
GitVersion_FullSemVer=0.2.0-beta{SubBranchName}.1+0
What is expected?
I would expect {SubBranchName} to be a proper value:
Example:
GitVersion_SemVer=0.2.0-beta-bravo.1
GitVersion_FullSemVer=0.2.0-beta-bravo.1+0
Steps to Reproduce
- Use a default GitVersion.yml set to
mode: ContinuousDelivery - Update the
releasebranch configuration to look like:
release:
regex: ^releases?[/-]\d+(?:.\d+)?(?:.\d+)(?<SubBranchName>.*)
label: 'beta{SubBranchName}'
- Run GitVersion against a branch named
release/0.2.0Observe the correct output:
GitVersion_SemVer=0.2.0-beta.1
- Run GitVersion against a branch named
release/0.2.0-bravoObserve the incorrect output:
GitVersion_SemVer=0.2.0-beta{SubBranchName}.1
RepositoryFixture Test
No response
Output log or link to your CI build (if appropriate).
No response
The functionality to "Support Regex for label property" was implemented in this PR:
- https://github.com/GitTools/GitVersion/pull/3687
I agree that the behavior you are describing here is not intuitive. If you like please fix this and create a pull request for it:
- Change the release and hotfix regex in GitFlowConfigurationBuilder and GitHubFlowConfigurationBuilder to support branch name override natively (e.g. label: '({captureGroups.SubBranchName} ?? "beta").ToLower()')
- Change the workflow resources in src\GitVersion.Configuration\Workflows
- Remove branchNameOverride parameter in ConfigurationExtensions::GetBranchSpecificLabel
- Change the logic in GetBranchSpecificLabel and use dynamic string interpolation
- Create integration tests
@asbjornu please confirm
Sounds reasonable. As long as no existing tests fail, I'm positive. :)
This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs.
This issue was closed because it has been stalled for 30 days with no activity. Thank you for your contributions