Mainline Not Incrementing SemVer when merging to main with AzureDevops #3800
-
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:
When calculating the version for the feature branch it looks correct. I get a version of 1.0.5-azure-devops.10 Here is my config:
Here are the logs for the run after merging the feature branch to main:
|
Beta Was this translation helpful? Give feedback.
Replies: 16 comments
-
I found that removing the |
Beta Was this translation helpful? Give feedback.
-
Figured it out. Have to explicitly define those rules.
|
Beta Was this translation helpful? Give feedback.
-
Hi folks, I'm struggling as well with auto incrementing 'Minor' version on my Mainline when feature branch gets merged into Master. This is what I see:
I'm using GitVersion.Tool 5.11.1 x64
|
Beta Was this translation helpful? Give feedback.
-
** I need to revise my statement. The mainline mode has a special logic to determine the increment strategy which is dependent on the following rules:
I cannot explain you why your scenario is not working because I don't know your workflow. Every person has a different expectation so we need to agree first on one or another workflow. Two known workflows are GitFlow and GitHub workflow which are very sophisticated and very good documented. At the beginning I would like to ask you to take a look on this two workflows and then mastering it with main line mode. I can guide you to the following examples which are explaining the GitFlow and GitHub workflows very well: https://gitversion.net/docs/learn/branching-strategies/gitflow/examples |
Beta Was this translation helpful? Give feedback.
-
@HHobeck thanks you for the feedback! I guess I just need to clarify if GitVersion be configured to automatically increment 'Minor' version when merge happens from feature branches. This one is related: #3114 I'm just trying to avoid manual version bumping with +semver:minor and +semver:patch commit messages. This would duplicate information since we already decided how to increment the number when we decided how to name our branch. Furthermore, commit message are often forgotten or used too often. We therefore don't want to rely on them and rely on something more simple: the branch name. In general, this is our flow: When a developer starts to work on something, he knows if he is working on a bug fix or a new feature. He therefore pulls the master branch to have the latest version and creates a branch from master. For a feature branch, he has to start the branch name by features/ and for a bug fix by bugfix/. He codes in that branch. Once he's done, he opens a pull request which gets built and reviewed. Once everything is approved and the code is ready to go to production, the pull request is accepted. At this point, here is how we expect GitVersion to behave for the numbering of the master branch: when it detects that a feature branch (i.e. a branch starting by features/) was merged, it should automatically increment the Minor number. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I'm not using the mainline mode by myselfe. But I have taken a look into the code and it seems to be working like you would expecting it: |
Beta Was this translation helpful? Give feedback.
-
I know that AzureDevops generates different merge messages compared to git (when using the build in PR mechanism). The information about the source branch are not part of the message and thus gets lost. That might be the reason. |
Beta Was this translation helpful? Give feedback.
-
@HHobeck |
Beta Was this translation helpful? Give feedback.
-
It is very hard for me to analyse your issue without any steps to reproduce. The only thing I can do is speculating: In my opinion it has something to do with how you are using AzureDevops. If you are finalize your PR you have different options like:
You need to select the first option and provide a customized merge message in the correct format if you ask me. |
Beta Was this translation helpful? Give feedback.
-
Hi, @HHobeck I got the same issue. The changes merged locally with the commands below work as expected but when I execute the same via Azure DevOps and PR to the main branch always PATCH is incremented. I've tried different versions of gitversion and all kinds of merge types. Have you solved that by that customize message? `git branch
gitversion /showvariable SemVer git checkout -b feature/test1 git commit -m "test commit 1" --allow-empty git checkout main git merge --no-ff feature/test1 gitversion /showvariable SemVer |
Beta Was this translation helpful? Give feedback.
-
Hi, @HHobeck I got the same issue. The changes merged locally with the commands below work as expected but when I execute the same via Azure DevOps and PR to the main branch always PATCH is incremented. I've tried different versions of gitversion and all kinds of merge types.
|
Beta Was this translation helpful? Give feedback.
-
If you have trouble with AzureDevops I would recommend you to take a look how the branch history looks like and answering the question: What is the difference between the history of AzureDevops compared to the history of native git? Like I already mentioned:
|
Beta Was this translation helpful? Give feedback.
-
Please see following issues on visualstudio.com: |
Beta Was this translation helpful? Give feedback.
-
Yes I saw it, testing right now |
Beta Was this translation helpful? Give feedback.
-
The best for me fit the solution with pull_request template messages. It's not ideal because requires additional effort and updates each repo but works with squash merges and Mainline mode used in our approach. That was described here if someone will need it. |
Beta Was this translation helpful? Give feedback.
The best for me fit the solution with pull_request template messages. It's not ideal because requires additional effort and updates each repo but works with squash merges and Mainline mode used in our approach.
That was described here if someone will need it.