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.

`+semver: patch` and `+semver: fix` bump Minor version instead of Patch

See original GitHub issue

Describe the bug +semver: patch and +semver: fix bump Minor version instead of Patch.

Expected Behavior

When entering a commit message of +semver: patch or +semver: fix, I expect the Patch digit of the version to be bumped.

Actual Behavior

When entering a commit message of +semver: patch or +semver: fix, the Minor version is being bumped, and the Patch version reset to 0.

Possible Fix

no idea

Steps to Reproduce

  1. Start with a develop branch with a git tag 2.0.1.
  2. Set commit-message-incrementing: Enabled in GitVersion.yml.
  3. Make a commit directly to develop, with +semver: patch or +semver: fix in the commit message.
  4. Inspect the generated versions.

Context

Running Gitversion in a Jenkins pipeline, trying to implement a standardized versioning scheme for my group/whole org, with as little manual involvement as possible.

Your Environment

Jenkins 2.277 Powershell 7 Windows Server 2012 R2 (on VMware) Gitversion 5.6.11+Branch.main.Sha.1680a89918cb1b3b15cd37ccf78079e1fc3bfdff git version 2.8.2.windows.1

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
mcasconecommented, Sep 14, 2021

Thank you @BinToss - I did post that same link in my request for more docs; some of them are detailed, some are not. I was on the receiving end of unintentionally-hurtful comments about documentation recently, so I didn’t mean for mine to be the same; but there is a lot of figuring it out on one’s own required here, so some more examples would be great.

I did eventually figure out that i was expecting a mainline style of operation, not either of the continuous modes. My current config looks like this:

assembly-versioning-scheme: MajorMinorPatchTag
mode: Mainline
tag-prefix: '[vV]'
branches:
  develop:
    increment: none
    tag: 'rc'
    is-mainline: true
    is-release-branch: true
    tracks-release-branches: true
  feature:
    mode: continuousdelivery
    increment: none
    tag: beta
    regex: ^[a-zA-Z0-9]{1,10}-[0-9]+
  release:
    increment: none
    tag: rc
    is-mainline: false
    is-release-branch: true
  pull-request:
    tag: rc
  hotfix:
    increment: none
    tag: hotfix
    is-mainline: false
    is-release-branch: true
ignore:
  sha: []
merge-message-formats: {}
commit-message-incrementing: Enabled
continuous-delivery-fallback-tag: ci
major-version-bump-message: '\+semver:\s?(breaking|major)'
minor-version-bump-message: '\+semver:\s?(no(n|t)-?breaking|feature|minor)'
patch-version-bump-message: '\+semver:\s?(fix|bug-?(fix)?|patch|increment(al)?|enhancements?)'
no-bump-message: '\+semver:\s?(none|skip)'

As you can see I also added some additional tokens to the auto-bump messages. I’m also having an issue with Release branches adding the metadata info to the tag; it’s an extended use case like this that i’m having trouble finding specific help for in the docs.

All of that being said, I believe this can be closed.

0reactions
BinTosscommented, Sep 14, 2021

Is there any documentation on these?

increment:
prevent-increment-of-merged-branch-version: 
track-merge-target: 
regex: 
source-branches:
tracks-release-branches:
is-release-branch: 
is-mainline:
pre-release-weight:
track-merge-target:

https://gitversion.net/docs/reference/configuration#increment-1 https://gitversion.net/docs/reference/configuration#prevent-increment-of-merged-branch-version https://gitversion.net/docs/reference/configuration#track-merge-target https://gitversion.net/docs/reference/configuration#regex https://gitversion.net/docs/reference/configuration#source-branches https://gitversion.net/docs/reference/configuration#tracks-release-branches https://gitversion.net/docs/reference/configuration#is-release-branch https://gitversion.net/docs/reference/configuration#is-mainline https://gitversion.net/docs/reference/configuration#pre-release-weight https://gitversion.net/docs/reference/configuration#track-merge-target

Regarding the original issue…

Possible Fix

gitversion -verbosity Diagnostic -diag should output info to help determine why the version is or isn’t being incremented.

If the version is incremented because of commits’ messages matching the message regex, then display which part of the version was bumped with the regex pattern that matched the commit for each discovered commit. Assuming the last version was 1.0.0, two commits match minor-version-bump-message: "^(feat)(\\([\\w\\s]*\\))?:" and one matches patch-version-bump-message: "^(fix|perf)(\\([\\w\\s]*\\))?:", then output:

minor-version-bump: ‘commitSHA’ patch-version-bump: ‘commitSHA’ minor-version-bump: ‘commitSHA’ next-version: 1.1.0

I’d also run into the issue of the expected version being 1.0.3 given three patch commits after a v1.0.0 commit, but gitversion was determining the develop version to be 1.1.0 or 1.0.8 depending on the mode that was set. I’d eventually gotten that sorted out after resetting main to develop and force pushing main.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Guidance on rectifying a minor bump that should have ...
... to Semantic Versioning 2.0.0 would suggest that you are OK with just bump the minor version. Given a version number MAJOR.MINOR.PATCH ......
Read more >
Reason for MINOR vs PATCH rules in SemVer
EDIT: It is a best practice to separate bug fixes (patches) from feature work (minor) and breaking changes (major), into separate releases.
Read more >
Semantic Versioning 2.0.0 | Semantic Versioning
PATCH version when you make backward compatible bug fixes. Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR....
Read more >
Semver doesn't mean major.minor.patch, it means fails. ...
I've been broken by every level of version bump. ... list all API changes, and it will tell you which changes are minor,...
Read more >
Version Incrementing
Semantic Versioning is all about releases, not commits or builds. ... +semver: minor will bump minor and +semver: patch or +semver: fix will...
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