Skip to content

[Bug] tag: '' doesn't strip the alpha tag in master branch #3223

@alsterg

Description

@alsterg

Describe the bug
According to documentation (and my understanding) GitVersion's default config should strip the PreReleaseTag from the last known tag and give back a SemVer that can be released as the stable/final/ga version e.g. 1.0.0 as opposed to 1.0.0-alpha.1, which is what it returns instead.

Expected Behavior

GitVersion should strip the tag and give as SymVersion: "SemVer": "1.0.0"

Actual Behavior

GitVersion will return the next PreReleaseNumber increment for the latest tag, which includes the alpha string.

$ dotnet-gitversion  
{
  "Major": 1,
  "Minor": 0,
  "Patch": 0,
  "PreReleaseTag": "alpha.1",
  "PreReleaseTagWithDash": "-alpha.1",
  "PreReleaseLabel": "alpha",
  "PreReleaseLabelWithDash": "-alpha",
  "PreReleaseNumber": 1,
  "WeightedPreReleaseNumber": 55001,
  "BuildMetaData": null,
  "BuildMetaDataPadded": "",
  "FullBuildMetaData": "Branch.master.Sha.1dd37abed877c31aac774472949883a75332b96c",
  "MajorMinorPatch": "1.0.0",
  "SemVer": "1.0.0-alpha.1",
  "LegacySemVer": "1.0.0-alpha1",
  "LegacySemVerPadded": "1.0.0-alpha0001",
  "AssemblySemVer": "1.0.0.0",
  "AssemblySemFileVer": "1.0.0.0",
  "FullSemVer": "1.0.0-alpha.1",
  "InformationalVersion": "1.0.0-alpha.1+Branch.master.Sha.1dd37abed877c31aac774472949883a75332b96c",
  "BranchName": "master",
  "EscapedBranchName": "master",
  "Sha": "1dd37abed877c31aac774472949883a75332b96c",
  "ShortSha": "1dd37ab",
  "NuGetVersionV2": "1.0.0-alpha0001",
  "NuGetVersion": "1.0.0-alpha0001",
  "NuGetPreReleaseTagV2": "alpha0001",
  "NuGetPreReleaseTag": "alpha0001",
  "VersionSourceSha": "1dd37abed877c31aac774472949883a75332b96c",
  "CommitsSinceVersionSource": 0,
  "CommitsSinceVersionSourcePadded": "0000",
  "UncommittedChanges": 0,
  "CommitDate": "2022-10-05"
}

Possible Fix

Set a tag value to a non empty string e.g. tag: 'ga'

Steps to Reproduce

 $mkdir delme
 $cd delme/
 $git init
 $touch README
 $git add README 
 $git commit -m README
 $git tag 1.0.0-alpha.1
 $dotnet-gitversion

GitVersion.yml fragment:

....
  main:
    mode: ContinuousDelivery
    tag: ''
    increment: Patch
    prevent-increment-of-merged-branch-version: true
    track-merge-target: false
    regex: ^master$|^main$
    source-branches:
    - develop
    - release
    tracks-release-branches: false
    is-release-branch: false
    is-mainline: true
    pre-release-weight: 55000
...

Context

This bug complicates our release process, as we need to code in our requirements by means outside of GitVersion.

  • Version Used: 5.10.3+Branch.support-5.x.Sha.bc9c9d003e655385e3dd1ba3bd013e04062d2f9b
  • Operating System and version (Windows 10, Ubuntu 18.04): RHEL 8
  • Link to your project:
  • Link to your CI build (if appropriate):

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions