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.

[Feature] Support release branch naming with MAJOR SemVer number only

See original GitHub issue

Support base version extraction from branch naming with just the <MAJOR> number.

Detailed Description

Currently GitVersion does work with our branch naming convention which has release branch naming format:

release/<MAJOR>

The major portion of the base version number is not discovered from branches in a typical repository like:

release/0 release/1 release/2

When we create a new release branch the version number (e.g. release/1 -> 1.0.0) is not picked up and a tag of v1 does not work either. However release/1.0 and a tag v1.0 do work.

Context

The change would allow GitVersion to be used without our branch numbering convention. This convention works well for us as we are daily adding bug fixes and/or features with a fairly short release cycle. Major version bumps are infrequent and result in customer code that is affectively orphaned and requires separate handling, so this branch name works very well for us.

Possible Implementation

Changing the text parsing in SemanticVersion to handle <MAJOR> only such as 3 -> 3.0.0 looks like it would fix the problem.

I’m unable to build the code to test, but a fix looks like changing the regex in SemanticVersion to:

private static readonly Regex ParseSemVer = new Regex( @"^(?<SemVer>(?<Major>\d+)(\.(?<Minor>\d+))?(\.(?<Patch>\d+))?)(\.(?<FourthPart>\d+))?(-(?<Tag>[^\+]*))?(\+(?<BuildMetaData>.*))?$", RegexOptions.Compiled);

And add the test case to SemanticVersionTests.ValidateVersionParsing:

[TestCase("1", 1, 0, 0, null, null, null, null, null, null, null, null)]

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
mglochsencommented, May 20, 2021

As I’m interested in this feature as well, I created a PR with the suggested changes.

1reaction
novasdreamcommented, Jun 8, 2021

it will conflict if you have something like

release/test-build-23

it will set your major to 23

you will not able to set back using your tags.

Read more comments on GitHub >

github_iconTop Results From Across the Web

GitFlow, should my release branch include minor version ...
1 Answer 1 · A Release branch should contain the MAJOR and the MINOR number (e.g. release/1.9) · A Hotfix branch (which contains...
Read more >
Release naming conventions
This naming convention is important for Drupal sites and infrastructure, such as Update Status and Composer.
Read more >
Semantic Versioning 2.0.0 | Semantic Versioning
Given a version number MAJOR.MINOR.PATCH, increment the: MAJOR version when you make incompatible API changes; MINOR version when you add functionality in a ......
Read more >
Semantic versioning with git flow and the marvelous way to ...
Git Flow is SemVer friendly meaning that it allows developers to create branches for each feature, patch, release or hotfix.
Read more >
Branch Based Versioning - Simon Maxen
Branch naming determines whether the artefact is published as work-in-progress snapshot or final release version; Major version increments ...
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