Skip to content

Mainline Not Incrementing SemVer #2955

@tfendt-belong-gg

Description

@tfendt-belong-gg

I'm trying to setup GitVersion and running in to an issue with generating the correct SemVer values. It is possible I just don't understand how it is supposed to work as I am new to this tool.

Here are the steps I took:

  • Added a version tag to the Main branch (1.0.5)
  • Created a new feature branch from main (feature/azure-devops)
  • Merged the feature branch to main

When calculating the version for the feature branch it looks correct. I get a version of 1.0.5-azure-devops.10
After merging the feature branch to main the calculated version is 1.0.5 and it should be 1.0.6 or rather 1.1.0 since this was a feature branch.

Here is my config:

next-version: 1.0
mode: Mainline
increment: Inherit
update-build-number: true
branches:
  main:
    regex: ^main$
    is-mainline: true

Here are the logs for the run after merging the feature branch to main:

INFO [01/04/22 17:56:51:81] Begin: Calculating base versions
    INFO [01/04/22 17:56:51:83] NextVersion in GitVersion configuration file: 1.0.0 with commit count source External Source
    INFO [01/04/22 17:56:51:85] Fallback base version: 0.1.0 with commit count source 94f8b33052712e905160b3056
    INFO [01/04/22 17:56:51:88] Git tag 'v1.0.5': 1.0.5 with commit count source a4b457d1029cb00d01adc
    INFO [01/04/22 17:56:51:88] Git tag 'v1.0.4.2': 1.0.4+2 with commit count source 5e1e5937323357620da2db3afcdd
    INFO [01/04/22 17:56:51:92] Found multiple base versions which will produce the same SemVer (1.0.6), taking oldest source for commit counting (Git tag 'v1.0.5')
    INFO [01/04/22 17:56:51:92] Base version used: Git tag 'v1.0.5': 1.0.5 with commit count source a4b457d1029cb00d01adc
  INFO [01/04/22 17:56:51:92] End: Calculating base versions (Took: 111.30ms)
  INFO [01/04/22 17:56:51:92] 2 commits found between a4b457d Merge branch 'feature/azure-devops' into 'main' and 01649a5 Merge branch 'feature/azure-devops' into 'main'
  INFO [01/04/22 17:56:51:93] Begin: Using mainline development mode to calculate current version
    INFO [01/04/22 17:56:51:94] Found possible mainline branches: main
    INFO [01/04/22 17:56:51:94] Mainline for current branch is main
    INFO [01/04/22 17:56:51:94] 2 commits found between a4b457d Merge branch 'feature/azure-devops' into 'main' and 01649a5 Merge branch 'feature/azure-devops' into 'main'
  INFO [01/04/22 17:56:51:94] End: Using mainline development mode to calculate current version (Took: 16.99ms)
  INFO [01/04/22 17:56:51:95] Begin: Creating dictionary
  INFO [01/04/22 17:56:51:95] End: Creating dictionary (Took: 4.89ms)
  INFO [01/04/22 17:56:51:95] Begin: Storing version variables to cache file D:\a\1\s\.git\gitversion_cache\9506D992C48C14BD0BC2C0F585BFC5F2F0AA2B5B.yml
  INFO [01/04/22 17:56:51:99] End: Storing version variables to cache file D:\a\1\s\.git\gitversion_cache\9506D992C48C14BD0BC2C0F585BFC5F2F0AA2B5B.yml (Took: 39.91ms)
Executing GenerateSetVersionMessage for 'AzurePipelines'.
Executing GenerateBuildLogOutput for 'AzurePipelines'.
{
  "Major": 1,
  "Minor": 0,
  "Patch": 5,
  "PreReleaseTag": "2",
  "PreReleaseTagWithDash": "",
  "PreReleaseLabel": "",
  "PreReleaseLabelWithDash": "",
  "PreReleaseNumber": null,
  "WeightedPreReleaseNumber": 60000,
  "BuildMetaData": null,
  "BuildMetaDataPadded": "",
  "FullBuildMetaData": "Branch.main.Sha.01649a5c492989d099a45ea0ddbc",
  "MajorMinorPatch": "1.0.5",
  "SemVer": "1.0.5",
  "LegacySemVer": "1.0.5",
  "LegacySemVerPadded": "1.0.5",
  "AssemblySemVer": "1.0.5.0",
  "AssemblySemFileVer": "1.0.5.0",
  "FullSemVer": "1.0.5",
  "InformationalVersion": "1.0.5+Branch.main.Sha.01649a5c492989d099a45ea0ddbc",
  "BranchName": "main",
  "EscapedBranchName": "main",
  "Sha": "01649a5c492989d099a45ea0ddbc",
  "ShortSha": "01649a5",
  "NuGetVersionV2": "1.0.5",
  "NuGetVersion": "1.0.5",
  "NuGetPreReleaseTagV2": "",
  "NuGetPreReleaseTag": "",
  "VersionSourceSha": "a4b457d1029cb00d01adc",
  "CommitsSinceVersionSource": 2,
  "CommitsSinceVersionSourcePadded": "0002",
  "UncommittedChanges": 0,
  "CommitDate": "2022-01-04"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions