-
Notifications
You must be signed in to change notification settings - Fork 654
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to configure GitVersion to work with 'Trunk Based Development' using 'Branch for Release' #3357
Comments
I think this issue is duplicated or at least related to #1789 track-merge-target in branch config not working. |
Thanks @HHobeck i see the similarities here but think it’s a different issue. In the referenced case the config parameter is “track-merge-target” and this looks for merges:
The difference is that trunk based development with release branch doesn’t use merges - instead it uses cherry pick - so this is the wrong config parameter to use. I’m not fluent in all the branching strategies, but from my limited exposure, I think this issue could actually be simpler, summarised as: In all cases, if a commit is tagged on a release branch it is a release. If v1.0.0 has been released, we should now be developing v1.1.0. However, the tags on release branches are always ignored. |
Maybe you are right and your scenario is different. But the root course of your issue is the same like the bug I have mentioned IMO (please see my comment here). |
Actually we have so many workflows out there and everyone has a different expectation/view on how the semantic version number should be generated. Also your scenario is very special and I see it (with cherry picking) the first time. I see GitVersion as a cooking machine where the user is responsible providing the correct ingredients. What I'm trieng to say is: It might be very helpful to try first and ask question to identify the route course and not just create a bug if your (custom) workflow not working from beginning. If you have a workflow which cannot be mapped and you need a new mechanism then please feel free and contribute with a PR or create feature improvement issue or discussion. See also the comment from asbjornu here:
At the end I don't know if your workflow can be mapped to GitVersion or not (defining the ingredients). It is hard work to answer and this is something you need to do. |
Could you please rename this issue like: GitVersion ignores tags on release branches when marked as IsMainline=true? |
I'm surprised this is a very special scenario, which it might be, but it's definitely not custom. I don't spend enough of my time writing software as an IT Manager, so I look for existing workflows to adopt rather than write my own custom. Here's why I don't think it's special:
Maybe it's not commonly used, but it seems odd to me that I've been strongly directed to this workflow by significant sources when researching the topic.
Apologies if I went about this the wrong way. However, I would point out, the very first line of my issue asks the question "can I/how do I configure for this workflow", and I found the bug template useful to describe my problem - and believed it was a bug I still believe it to be one (either in code or documentation), that neither a tagged commit on a defined release branch counts as a source for version incrementing by default, and Additionally, the tracks-release-branch documentation doesn't explain what it does, and the naming of the parameter doesn't match how it's described ("Indicates this branch config represents develop in GitFlow.") - a better parameter name for this description would be "is-develop-branch". Looking at history, it appears this was once the case, so if this isn't a bug, perhaps my confusion is with the documentation describing what As an aside - is there any workflow that exists where you would tag a commit with a version number on a release branch and it not be an indication of a release? If not, perhaps this is the feature request I should be raising? Happy to work with you on the best way forward, just a matter of identifying that. I can write a little C#, so if we agree on the way forward I'll do my best to raise a PR. Hope you understand my confusion and how I got here. |
I did some research into the renaming of
In my case, I cannot configure gitversion to achieve this behavior. I'm just setting up an environment to see if I can write some test cases for this. |
Okay maybe I haven't used the correct words sorry for the confusion. Your scenario is maybe not custom and widely used in the community. For me it is a new workflow which I'm not used to and also the default supported workflow of GitVersion is the gitflow and the github workflow (please see gitflow and github sequence diagram). Of course GitVersion is highly configurable and can be (or at least should be able to be) adapted to any other workflows out there (including custom ones ;)). If I'm saying custom then I mean it's not the default workflow in GitVersion and the configuration file needs to be adapted from user point of view. BTW: In GitVersion we have also a Mainline option which reflects in my opinion the trunk-base development workflow but without any tagging. So you see if your are talking from the trunk-base workflow nine of ten persons have a different expectation how it should be working. |
Yes no problem. Just want to point out that we are all doing our best and a bug has a negative implication. It's hard work to analyses the behavior of custom or different workflows and find out what the root course might be. Anyway in your scenario I think you are right and we have a bug. I think the
Yep I agree the documentation gives not really a good explanation. The
The only scenario I know is for beta releases. Here you are tagging the beta version to increment the pre-release tag to the next one. But this process is just within the release/x.x.x branch and doesn't affect any other branches like main (of course because it is not a release to manufacturing (RTM)). I don't think that we need a new mechanism to fullfill your requirements. |
Thank you very much for your input. I'm very interested in standard workflows out there and would like to integrate (all of them) into GitVersion. Therefor I have created a new feature issue #3305. Please have a look and let me know what you think. |
Okay, I've figured it out, and trunk-based development with release branches is easily supportable with minimal config changes. The key was in the following PR: Bump develop when release branch created #832 Develop gets bumped when a release branch is created, therefore tags on the release branch are not actually necessary to get that bump. Two major things I was doing wrong:
In the end, I have just disabled the main branch, and set regex for develop to match master/main, and removed release as a source branch for release. Finally I set release branch into Here's the config I've settled on: branches:
main:
# Match nothing
regex: ^\b$
develop:
# Development is done on master
regex: ^master$|^main$
release:
source-branches:
- main
mode: ContinuousDeployment |
I think this is a brilliant idea. It would also open up for the community to add/suggest built-in templates as pull requests in future. For example, I could suggest the above config as a "trunk-based development with release branches" workflow and others can easily make use of it. |
Thanks for your help @HHobeck - your comments pushed me to find the solution in the end. This issue can be closed unless you still think we've identified a bug rather than my misinterpretation of the docs after reviewing how I fixed it:
This case might also have some useful information to improve the |
Great. It's a pleasure to help you. I think we don't need a bug for enhancing documentation. Thus I'm going to close it. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Edit: See how to configure this properly here: #3357 (comment)
TLDR: How do I/is it possible to configure GitVersion to work with: https://trunkbaseddevelopment.com/branch-for-release/ when tags only exist on release branches.
Describe the bug
GitVersion ignores tags on release branches, so main/develop are not showing the correct version.
It appears "tracks-release-branches" does nothing - i.e. setting this to true on the master branch doesn't fix the issue.
We use trunk-based development with branch for release - see here: https://trunkbaseddevelopment.com/branch-for-release/
So at some point in development we branch off master into, for example, release-1.0.x and start preparing a release.
All bug fixes are made on master, then cherry-picked into the release branch. These changes are never merged back to master.
When a release is ready, the latest commit on the release branch is tagged, for example 1.0.0
Expected Behavior
At this point, I expect master branch to be showing version 1.1.0
Actual Behavior
Master branch is showing version 0.1.0
Possible Fix
Fix/cause unknown - could be my configuration (this is reproducible with default config, and any configuration I can think of)
Steps to Reproduce
Context
Implement gitversion for trunk-based development using Branch for release. Allow developers to continue committing to master by cherry-picking fixes from master into release branch when preparing a release. Tag release branch - master branch shows correct version for next release.
Your Environment
Multiple versions tested, exists in 5.12.0
gitversion /diag:
The text was updated successfully, but these errors were encountered: