Skip to content

[Bug] Mainline mode breaking change between 5.1.2 & 5.1.3 #2241

@rducom

Description

@rducom

Describe the bug

Breaking change in the version calculation on a tagged commit. The last working release is 5.1.2

Expected Behavior

{
  "Major":3,
  "Minor":1,
  "Patch":3,
  "PreReleaseTag":"",
  "PreReleaseTagWithDash":"",
  "PreReleaseLabel":"",
  "PreReleaseNumber":"",
  "WeightedPreReleaseNumber":"",
  "BuildMetaData":"",
  "BuildMetaDataPadded":"",
  "FullBuildMetaData":"Branch.master.Sha.517daf9325182cf5bbf47fc1b23a4af6c590f72c",
  "MajorMinorPatch":"3.1.3",
  "SemVer":"3.1.3",
  "LegacySemVer":"3.1.3",
  "LegacySemVerPadded":"3.1.3",
  "AssemblySemVer":"3.1.3.0",
  "AssemblySemFileVer":"3.1.3.0",
  "FullSemVer":"3.1.3",
  "InformationalVersion":"3.1.3+Branch.master.Sha.517daf9325182cf5bbf47fc1b23a4af6c590f72c",
  "BranchName":"master",
  "Sha":"517daf9325182cf5bbf47fc1b23a4af6c590f72c",
  "ShortSha":"517daf9",
  "NuGetVersionV2":"3.1.3",
  "NuGetVersion":"3.1.3",
  "NuGetPreReleaseTagV2":"",
  "NuGetPreReleaseTag":"",
  "VersionSourceSha":"517daf9325182cf5bbf47fc1b23a4af6c590f72c",
  "CommitsSinceVersionSource":0,
  "CommitsSinceVersionSourcePadded":"0000",
  "CommitDate":"2020-04-22"
}

Actual Behavior

{
  "Major":3,
  "Minor":1,
  "Patch":4,
  "PreReleaseTag":"beta.6",
  "PreReleaseTagWithDash":"-beta.6",
  "PreReleaseLabel":"beta",
  "PreReleaseNumber":6,
  "WeightedPreReleaseNumber":55006,
  "BuildMetaData":"",
  "BuildMetaDataPadded":"",
  "FullBuildMetaData":"Branch.master.Sha.517daf9325182cf5bbf47fc1b23a4af6c590f72c",
  "MajorMinorPatch":"3.1.4",
  "SemVer":"3.1.4-beta.6",
  "LegacySemVer":"3.1.4-beta6",
  "LegacySemVerPadded":"3.1.4-beta0006",
  "AssemblySemVer":"3.1.4.0",
  "AssemblySemFileVer":"3.1.4.0",
  "FullSemVer":"3.1.4-beta.6",
  "InformationalVersion":"3.1.4-beta.6+Branch.master.Sha.517daf9325182cf5bbf47fc1b23a4af6c590f72c",
  "BranchName":"master",
  "Sha":"517daf9325182cf5bbf47fc1b23a4af6c590f72c",
  "ShortSha":"517daf9",
  "NuGetVersionV2":"3.1.4-beta0006",
  "NuGetVersion":"3.1.4-beta0006",
  "NuGetPreReleaseTagV2":"beta0006",
  "NuGetPreReleaseTag":"beta0006",
  "VersionSourceSha":"33fb5feef4a83c079656dce3eac57b27f93bc39b",
  "CommitsSinceVersionSource":6,
  "CommitsSinceVersionSourcePadded":"0006",
  "CommitDate":"2020-04-22"
}

Both outputs are the dotnet gitversion call on the exact same commit, with just different GitVersion.Tool versions

Steps to Reproduce

Build a tag on Jenkins with 5.1.3, with the following Gitversion.yml

mode: Mainline
branches: 
  master:
    regex: ^master$
    tag: 'beta'
    is-release-branch: true
    is-mainline: true
  release:
    regex: releases?[/-]
    tag: ''
    is-release-branch: true
    is-mainline: true

Context

This bug breaks our release pipeline

Your Environment

Windows / Jenkins / dotnet core libs
Unfortunately, this happens on private projects, so can't link you to the git repo / CI

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions