question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Tag versioning fails if newer 'release' branch exists

See original GitHub issue

Describe the bug When using TBD and following configuration in gitversion file

mode: ContinuousDeployment
assembly-informational-format: '{FullSemVer}'
tag-prefix: 'web/'
branches:
  develop: 
    increment: Minor
    regex: master    
    tracks-release-branches: true
    prevent-increment-of-merged-branch-version: true
    track-merge-target: false
    tag: 'dev'
  master:
    regex: none
  hotfix:
    regex: ^fix(es)?[/-]web[/-]
    source-branches: ['develop']
  feature:
    regex: ^features?[/-]web[/-]
    source-branches: ['develop']
  release:
    regex: ^releases?[/-]web[/-]
    source-branches: ['develop']
    increment: Patch
    tag: 'qa'

When a new release branch is created (for example release/web/0.19) gitversion works fine when a new tag has been created (for example tag web/0.19.3).

A few days ago a new branch release/web/1.0 was created in order to get ready for launch

Today a new PR with a fix is pushed to release/web/0.19 and the build is named correctly: 0.19.4-qa.4 Then a new tag is created for this patch version: web/0.19.4. Now gitversion fails giving the right name to the build. It names the build as #1.0.0-tags-production-0-19-4.1+29

Expected Behavior

Build should be named using the new tag

Actual Behavior

Builds are tagged using as base version the newer release branch instead the one where the tag has been created

Possible Fix

Use the version number in tag, if it has been created in the release branch for same major.minor version

Steps to Reproduce

  • Create a repo using the previous gitversion file
  • Add a couple of commits to main
  • Create a release branch 0.1
  • Tag the release branch with number 0.1.0
  • Create a release branch 1.0
  • Add a commit to main, then cherry pick to release/0.1
  • Tag the release branch with number 0.1.1

Context

Your Environment

Azure DevOps Server 2020

  • Version Used: 5.7.0
  • Operating System and version (Windows 10, Ubuntu 18.04): Windows / Ubuntu agents

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
farlopcommented, Mar 8, 2022

I tried to build a test case but couldn’t reproduce the issue. Sorry for not updating.

Will try the parched version once is released and let you know about the result.

0reactions
ppi-kosipenkocommented, Oct 6, 2022

Fix for this bug was reverted in 5.10.1 release (see: https://github.com/GitTools/GitVersion/pull/3085). Can you re-open the bug? I tried latest version of the tool and it is setting version based on the release branch name, instead of the tag. It works as expected in version 5.10.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Bug] 5.5.1 Continue failing to get version when building ...
As GitVersion creates a new branch named 'tags/1.0.4' it fails calculating the version. Steps to Reproduce. When we add a new fix we...
Read more >
Git hotfixing existing tags/releases?
Suppose I roll a new version to production e.g. 1.0 using git tagging and continue working on master. What happens if I need...
Read more >
Troubleshooting - semantic-release
If a tag with the name already in your repository, Git will throw and error as tags must be unique across the repository....
Read more >
Gitflow release branch process from start to finish example
After the “git flow release finish” command runs, the release branch should be deleted and a new Git tag exists in the repository....
Read more >
git tag | Atlassian Git Tutorial
Git tag command is the primary driver of tag: creation, modification and deletion. Learn how you can use them to organize code and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found