-
I am trying to adhere the default branching and release model suggested by GitVersion with an almost empty GitVersion.yml. I have a release preparation branch (e.g. My problem now is that GitVersion continuously increments and decrements So how can I prevent this continuous incrementation and decrementation of versions on the Here is how the incrementation and decrementation happens: Suppose I am ready to create my first beta release. So I create the branch %%{init: { 'logLevel': 'debug', 'theme': 'base', 'gitGraph': {'showCommitLabel':false}} }%%
gitGraph
commit
branch develop
commit
commit
branch release/1.0.0
checkout release/1.0.0
commit
GitVersion gives me the following versions:
Meanwhile the team continues development and makes new commits on %%{init: { 'logLevel': 'debug', 'theme': 'base', 'gitGraph': {'showCommitLabel':false}} }%%
gitGraph
commit
branch develop
commit
commit
branch release/1.0.0
checkout release/1.0.0
commit
checkout develop
commit
commit
Now GitVersion incremented the minor version on
Next I decide to make the actual %%{init: { 'logLevel': 'debug', 'theme': 'base', 'gitGraph': {'showCommitLabel':false}} }%%
gitGraph
commit
branch develop
commit
commit
branch release/1.0.0
checkout release/1.0.0
commit tag:"1.0.0-beta1"
checkout develop
commit
commit
GitVersion still generates the same versions, with minor incremented on
The team continues development on %%{init: { 'logLevel': 'debug', 'theme': 'base', 'gitGraph': {'showCommitLabel':false}} }%%
gitGraph
commit
branch develop
commit
commit
branch release/1.0.0
checkout release/1.0.0
commit tag:"1.0.0-beta1"
checkout develop
commit
commit
commit
commit
checkout release/1.0.0
merge develop
Now GitVersion decremented the minor version on
It stays this way also after I made the release by triggering a relase build on the merge commit which will add the prerelease %%{init: { 'logLevel': 'debug', 'theme': 'base', 'gitGraph': {'showCommitLabel':false}} }%%
gitGraph
commit
branch develop
commit
commit
branch release/1.0.0
checkout release/1.0.0
commit tag:"1.0.0-beta1"
checkout develop
commit
commit
commit
commit
checkout release/1.0.0
merge develop tag: "1.0.0-beta2"
But as soon as deveopment continues with commits on %%{init: { 'logLevel': 'debug', 'theme': 'base', 'gitGraph': {'showCommitLabel':false}} }%%
gitGraph
commit
branch develop
commit
commit
branch release/1.0.0
checkout release/1.0.0
commit tag:"1.0.0-beta1"
checkout develop
commit
commit
commit
commit
checkout release/1.0.0
merge develop tag: "1.0.0-beta2"
checkout develop
commit
GitVerions again has incremented minor on develop.
|
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 18 replies
-
Please remove |
Beta Was this translation helpful? Give feedback.
-
@asbjornu As requested here, I have created a demonstrating test in this PR #3191. The test does exactly what I described here. |
Beta Was this translation helpful? Give feedback.
-
I have taken a look into your ReducedReleaseWorkflowDemo scenario. Really nice how you have documented this. ;) I'm not sure what your releasing and branching strategy is exactly but I can tell you it looks like you are following the git flow workflow. Or I'm wrong? Please see the sequence diagram here. Anyway I would like to come back to your test scenario and answer your question:
The different between the alpha and beta release is documented here. That means at this point you are finalizing your beta release someone else can work already on a future release at the same time. What I'm saying is it doesn't matter if you have already released the version 1.0.0 on production or not at this point you know already what the targeting version would be in the development branch (the next version after 1.0.0). Think about it what happened if you role out a alpha release on a test environment to make a demonstration of your new feature.
I agree with you this is in my opinion a bug. I think it is already fixed in this PullRequest #3190. For clarification my expectation would be in that case that on the develop branch the version 1.1.0-alpha.0 will be generated. Is it also what do you anticipate? In addition I want to say that you not often or even never update the changes from develop to the release branch (develop -> release) because you are already feature complete. This is not not permitted in general it is just not common because it changes the alpha version back to zero which might be a little bit confusing for the tester (or if I think about it it might be problematic if you created a nuget package for the alpha version before). Other way around would be more realistic because you are stabilizing the release and want to have the changes in the develop branch as well (release -> develop). If you consider this workflow the version of the alpha and beta version goes always up and never down. If you want to create a new release then you have to create a new release branch for instance 1.1.0 when you are done with the feature phase on the develop branch. Generally release branches are not existing forever and they have to be merged to main and then deleted after they have been released to manufacturing. |
Beta Was this translation helpful? Give feedback.
-
I have thought about your scenario the hole day. Actually your scenario is really on of a worst case scenario in a software development process. Hopefully your are not in the role of a product manager because I would suggest you to engage a new one ;). I'm just kidding. Your scenario and the question about it is quite valid. Of course cherry picking would be a possibility. You can merge the changes with rebase and fast-forward or with a squash commit or even manually. But if we go two steps back and think about the actual business use case you are facing here this is even more complex. What does this mean? Let’s say we have two features feature/A and feature/B. The product manager decide to put this two features in the next release (this will be the version 1.0.0). So you put the features into the develop branch and integrate it until you have proof it in a alpha version. Now you go in the feature complete phase and create a beta version. You doing this by creating just a release/1.0.0 from develop branch (develop -> release), build and deploy a version on a testing environment and give it to your business or tester. Now your product manager comes to you and says: "Pleased release manger I would like to have just the feature/A and a new feature/C in the next release"! Now this is the point where you have already communicate with the business and told the tester that they can expect the feature/A and B in the version 1.0.0. Or you have technical or regulatory constraints who knows!? The point here is that you need to cancel the hole release and skip this number 1.0.0. You are deleting the release branch or even the develop branch and start again integrating the feature/A and feature/C into a new alpha version with the number 1.1.0 (or even 1.2.0 if the version 1.1.0 is burned too) and start the hole process from beginning. You could say but if I delete the release branch the next version will be just the 1.0.0 in the develop branch. Yes you are right but exactly for this use case the next version configuration or bump messages are good for in GitVersion. In addition I would like to point out here the following: To be on the safe side I would suggest you to create the feature still from the main branch (main -> feature) and preserve it until you have released the features to production (main -> feature -> develop -> release -> main and tagging). |
Beta Was this translation helpful? Give feedback.
-
I'm just surprised that you would like to build a release candidate with version 1.1.0-alpha.0. Because this version is equivalent to the version 1.0.0-beta.1 at the release branch. My suggestion is not creating the version from develop branch but from release branch. The source code is the same right? If that is not true then you are leaving the git flow workflow and doing your own workflow. Please notice every version or phase has a meaning and reflects an expectation or constraint which can be confusing when you are customizing it. As a workaround you can increase the next version number in configuration and set it explicit to 1.1.0. |
Beta Was this translation helpful? Give feedback.
-
Okay that's vanilla cherry picking what you are doing... I think until your version in develop is not so far away from the version in release branch this might be working. But I wouldn't recommend this process (see explanation of the last post). Just wondering why you are not creating a feature branch from the main or release branch and merge it two times in release and develop branch (main or release -> feature -> release and develop)? You should know cherry picking is very error-prone. |
Beta Was this translation helpful? Give feedback.
-
I have used your test and adapted it slightly. Please take a look to the following file in my PR here: src/GitVersion.Core.Tests/IntegrationTests/PreventDecrementationOfVersionsOnTheDevelopBranch.cs |
Beta Was this translation helpful? Give feedback.
-
If you do not want to increase the minor version of the develop branch have you tried to change the configuration setting and set the increment property to None?
|
Beta Was this translation helpful? Give feedback.
I have thought about your scenario the hole day. Actually your scenario is really on of a worst case scenario in a software development process. Hopefully your are not in the role of a product manager because I would suggest you to engage a new one ;). I'm just kidding…