GitTools / GitVersion

From git log to SemVer in no time
https://gitversion.net/docs/
MIT License
2.87k stars 654 forks source link

[ISSUE]: Regex Capture Groups don't work correctly on release branch. #4019

Closed BenB196 closed 3 weeks ago

BenB196 commented 6 months ago

Prerequisites

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

  1. Use a default GitVersion.yml set to mode: ContinuousDelivery
  2. Update the release branch configuration to look like:
    release:
    regex: ^releases?[/-]\d+(?:.\d+)?(?:.\d+)(?<SubBranchName>.*)
    label: 'beta{SubBranchName}'
  3. Run GitVersion against a branch named release/0.2.0 Observe the correct output:
    GitVersion_SemVer=0.2.0-beta.1
  4. Run GitVersion against a branch named release/0.2.0-bravo Observe 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

HHobeck commented 6 months ago

The functionality to "Support Regex for label property" was implemented in this PR:

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:

image

HHobeck commented 6 months ago

@asbjornu please confirm

asbjornu commented 4 months ago

Sounds reasonable. As long as no existing tests fail, I'm positive. :)

github-actions[bot] commented 1 month ago

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.

github-actions[bot] commented 3 weeks ago

This issue was closed because it has been stalled for 30 days with no activity. Thank you for your contributions