-
Notifications
You must be signed in to change notification settings - Fork 654
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
Use increment from merged branch in mainline mode #1716
Comments
This behaviour isn't supported out of the box by GitVersion. As a matter of fact, #1541 might even have made your use-case work less. You might be able to mimic it with the release:
regex: (major?[/-])|(minor?[/-])(patch?[/-]) |
I'm quite surprised that this isn't something that GitVersion can do honestly; and it leaves me unsure of how branch specific increments are supposed to be used then. Also, I really don't see how setting up the different work branches with a single release branch configuration could help here, as I wouldn't be able to set the increment differently for each of them. |
Your Git flow is unique. I've never seen anyone do anything like you do in my 10 years of working with Git and 5 years of working with GitVersion. Being surprised GitVersion doesn't support your flow is therefore … surprising to me. 😄 Branch-specific increments is based on pre-existing knowledge about what each branch is used for. Perhaps you could set it up so your |
I'll admit, I'd been put in the situation of needing to sort out doing this from having never really had any real instruction on what standard git branching strategies there are, and how to use them; so I more or less ended up putting together the simplest method I could think of. I guess I'm also just a bit surprised that it's not something that's been done before, since it's almost exactly what's depicted in the diagram for mainline development in the documentation; except determining the increment from the branch name, rather than marking the increments manually. I'll also try switching the branch configurations onto those as you said, and see how I get on. |
If you used |
I do not think that this request is strange. We would like to do the same thing. |
@ActSabke, what's being discussed in #1221 only applies if the source branches are actually identified as feature branches. GitVersion can't read the mind of developers, so whether they know a branch is a feature branch or a bugfix doesn't help GitVersion one tiny bit. The only way GitVersion can know whether a branch is X or Y is by convention or configuration. If you deviate from the convention, you need to apply appropriate configuration. If you deviate enough, even configuration won't help you. Sorry, but GitVersion is not made to support every thinkable, home-grown, self-invented branching strategy. GitVersion supports less than a handful well-documented, best-practice branching strategies and if they don't suit your needs and you're having a hard time getting GitVersion to work for you, I'm sorry to say GitVersion might not be the right tool for you. |
@ActSabke I think I've got my configuration for this working now, but had not yet updated this issue as I've not been able to test it thoroughly on our remote system. I believe that the issue that I'd been encountering before was that GitVersion was parsing the remote name as part of the branch from GitHub's merge commit messages, and was not matching the associated branch configurations as a result. I'll also explicitly warn not to edit the merge commit message, as that has tripped me up a couple of times before I'd realised that GitVersion was using it to identify the names of the merged branches. Here is the configuration I am currently using: mode: Mainline
branches:
# Using custom branch configurations to ensure that no default configuation muddles things.
# "remote" here should be replaced by the name of the git-hub organisation to be able to
# match branch names in github pull request merges correctly.
master:
regex: '(remote/)?master'
tag: ''
increment: None
clean:
regex: '(remote/)?(clean|none)[/-]'
tag: useBranchName
increment: None
source-branches: ['master']
mode: ContinuousDelivery
patch:
regex: '(remote/)?(patch|((bug-?)?fix))[/-]'
tag: useBranchName
increment: Patch
source-branches: ['master']
mode: ContinuousDelivery
minor:
regex: '(remote/)?(minor|feature)[/-]'
tag: useBranchName
increment: Minor
source-branches: ['master']
mode: ContinuousDelivery
major:
regex: '(remote/)?(major|breaking)[/-]'
tag: useBranchName
increment: Major
source-branches: ['master']
mode: ContinuousDelivery
# Disable default branch configs with super specific branch regex.
feature:
regex: '^f$'
release:
regex: '^r$'
support:
regex: '^s$'
develop:
regex: '^d$'
pull-request:
regex: '^p$'
hotfix:
regex: '^h$' |
@mchippingtonderrick-afl, thank you for your answer. |
@ActSabke, sorry, but I'm unable to answer that. The only answer I can provide is that if you get GitVersion to work this way, then; yes. Otherwise; no. I have not tried myself and I don't think there's any regression tests for this scenario, so I can't guarantee that if this works now it's also going to work in the future. If you get this to work, you're more than welcome to send us a pull request that adds such a test for future-proofing your use-case, though. |
This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions. |
Creating a new issue as my original issue received no attention, and what I am asking has changed somewhat.
I am using an extremely simple mainline branching strategy, with a single master branch, and major, minor, and patch branches, with matching version increments.
I want any merge into the master branch to use the version number / version increment from the merged branch. However, when I merge with my current configuration, it uses the increment for the master branch.
Example trimmed history:
What do I need to do to achieve this behaviour?
The text was updated successfully, but these errors were encountered: