-
Notifications
You must be signed in to change notification settings - Fork 31
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
Wrong insignificant tag generated when using maintenance branches with patch releases #180
Comments
Yeah, that definitely seems wrong for multiple reasons. Feels like it should be at least 1.2.4-dev instead of 1.2.2-dev if 1.2.3 is already out. But you're saying you'd really want it to be 1.3.0-dev in that case? I've tried to avoid baking branch names into resolution, so I'll want to see if there's a way around it in this situation. EDIT: Misread, I see the ones you called out as expected. Will make some tests to reproduce and also see if the commit message inference plays any role in the issue. |
Yeah my thinking was: If only patches follow a final release on the master branch, then these patches must be hotfixes of that final release. As a developer I don't see a reason why I would do a significant As a developer I would only start a new significant Thus I think reckon could switch to insignificant 1.3.0-dev version if only patches are found since the last final release because reckon could assume that a new feature will land soon anyways. This has the benefit of escaping the 1.2.x maintenance release tags early and IMHO it would be fine for developers. |
FYI, I have a test case reproducing this now. Will look into a fix. |
Our prior parallel version logic allowed reckon to increment by the requested scope a second time in order to avoid a parallel version. However, if that version is also in the parallel branch, it would fail saying the version was already claimed. In the new logic, if we bump the target normal in order to avoid a parallel version and that version is still in the parallel versions list, we increment increment by a higher scope (i.e. by MAJOR if they requested MINOR or by MINOR if they requested PATCH). This may resolve many of the bugs we had with parallel version handling. The two unintuitive parts are that it may still not increment as far as someone wants in some cases. And in others someone could be surprised that we incremented by a higher scope than they asked for. To deal with the latter, we may want to consider making a distinction between "soft" and "hard" scopes (i.e. did they explicitly ask for the scope or did it get inferred). This was clearer in the past, when "inferred" really only meant no input from the scope calc. However, with the new commit message scope calc, that's really more of a "soft" scope request than an explicit one. It's trickier because to the Reckoner there's no difference between commit message scope calcs and explicit user-requested scope calcs. Will run this by the users and see what they think. Fixes #180 Related to #102
Our prior parallel version logic allowed reckon to increment by the requested scope a second time in order to avoid a parallel version. However, if that version is also in the parallel branch, it would fail saying the version was already claimed. In the new logic, if we bump the target normal in order to avoid a parallel version and that version is still in the parallel versions list, we increment increment by a higher scope (i.e. by MAJOR if they requested MINOR or by MINOR if they requested PATCH). This may resolve many of the bugs we had with parallel version handling. The two unintuitive parts are that it may still not increment as far as someone wants in some cases. And in others someone could be surprised that we incremented by a higher scope than they asked for. To deal with the latter, we may want to consider making a distinction between "soft" and "hard" scopes (i.e. did they explicitly ask for the scope or did it get inferred). This was clearer in the past, when "inferred" really only meant no input from the scope calc. However, with the new commit message scope calc, that's really more of a "soft" scope request than an explicit one. It's trickier because to the Reckoner there's no difference between commit message scope calcs and explicit user-requested scope calcs. Will run this by the users and see what they think. Fixes #180 Related to #102
Our prior parallel version logic allowed reckon to increment by the requested scope a second time in order to avoid a parallel version. However, if that version is also in the parallel branch, it would fail saying the version was already claimed. In the new logic, if we bump the target normal in order to avoid a parallel version and that version is still in the parallel versions list, we increment increment by a higher scope (i.e. by MAJOR if they requested MINOR or by MINOR if they requested PATCH). This may resolve many of the bugs we had with parallel version handling. The two unintuitive parts are that it may still not increment as far as someone wants in some cases. And in others someone could be surprised that we incremented by a higher scope than they asked for. To deal with the latter, we may want to consider making a distinction between "soft" and "hard" scopes (i.e. did they explicitly ask for the scope or did it get inferred). This was clearer in the past, when "inferred" really only meant no input from the scope calc. However, with the new commit message scope calc, that's really more of a "soft" scope request than an explicit one. It's trickier because to the Reckoner there's no difference between commit message scope calcs and explicit user-requested scope calcs. Will run this by the users and see what they think. Fixes #180 Related to #102
@jnehlmeier Would appreciate any feedback on the solution described in #181 and released as 0.17.0-beta.1. |
@ajoberstar I tried 0.17.0-beta.2 with some cases and it seems like it won't generate any versions that have already been taken. So it is definitely better than before. However it is kind of annoying that the behavior of reckon isn't consistent now. The behavior changes depending on the number of tags I made in a parallel branch. So sometimes it does a patch increment and sometimes if will do a minor increment. Someone (co-workers) not knowing reckon well will have questions about it. I feel like behavior should be consistent. If I see it correctly you do not want to make a loop to calculate a free version but instead you try it twice and if both are already taken you give up and increment the next higher scope. That is basically why behavior isn't consistent. Maybe I am thinking too much in my workflow but I have a really hard time to imagine having a calculated version on master branch that "belongs" to a parallel maintenance branch. In my example above reckon will generate 1.3.0-dev since I have three tags on the maintenance/1.2.x branch. But if I delete tags 1.2.[1-3] and only create 1.2.1 tag on maintenance/1.2.x branch reckon will generate 1.2.2-dev. While technically ok, given I have only done patch commits on master branch, it still has a strong naming connection to the maintenance/1.2.x branch even though we are on master. Maybe providing a configuration option that tells reckon to always increment the higher scope would be a solution to gain back some consistency. So when this option is active you only try to calculate a version once instead of twice before falling back to increment the next higher scope. The result is that as soon as a single tag has been made on a parallel branch, the next higher scope will be incremented. |
Yeah that was my concern with this approach.
What do you mean by a loop? Are you suggesting: first increment patch, then increment minor, then increment major until you find a free one? Might be misunderstanding you.
So maybe an option around Similarly a parallelBranchScope=MAJOR would cover scenarios where a you only do maintenance branches for 2.x or 3.x. parallelBranchScope=PATCH which would probably be the default would just assume parallels are targeting an exact version (e.g. branching off from mainline before all final releases).
Yeah, for now this limitation would stay. |
No. I was saying your current code tries to increment twice (which could be refactored into a loop with two iterations) before doing something else (incrementing using an incremented scope).
I kind of like that. Assuming I have configured Given my example image above, assume that
|
Parallel logic will only kick if there are tagged versions that are both:
If no parallel version tags are found, the I'll code this up to make sure it behaves that way, but let me know if you expect something different to happen. |
Here's the new approach, which I'll release as 0.17.0-beta.3 |
That is what I would expect too, given that both these branches are branched off of an older commit. I assume if I would rebase both these feature branches on master (to get the latest master changes into the feature branch), both would have the same 1.2.1-dev version but with different commit hashes in its version, right? At least that is what I would expect. I will play a bit with 0.17.0-beta.3, to see how it behaves and how it feels. |
I'd expect the same |
On the other hand the error message tells me to rebase the feature branch because it has become too old to do a significant release from. |
For the feature branches, would you expect them to stay as Presuming that is what you were thinking, this seems like a long-standing issue with the parallel logic and not really dependent on the new changes. Prior to this version, I think they would have still been bumped, but to What I'm wondering is maybe the parallel branch behavior shouldn't kick in unless it's a significant release? That way a feature branch, which you would never make a significant release on, would always just stay on the same version instead of trying to avoid the parallel. Though I wonder about main/master vs a release/maintenance branch. Will have to think some more. |
Interestingly, it was never documented or tested in a way where an insignificant had to use the same parallel avoidance. I'd still call it out as a breaking change if I went this way.
Here's a PR with what the logic change would be: #183 |
Yes that is what I would expect.
Yes that is why I said that for insignificant versions on a feature branch only the tag history of that feature branch is relevant because significant and final versions on master branch will always increase. So there is no way that an additional tag on master branch will conflict with insignificant versions on feature branches.
On release/maintenance branches we continuously create pre-release (to pre-release fixes) or final versions as tags and we want to make sure that future master branch tags do not conflict with these. However during local development of fixes in the release/maintenance branch we also need to create insignificant versions to test fixes locally or on CI. Inference of these insignificant versions only need to check history of that release/maintenance branch (so the same behavior as for feature branches, which only has insignificant versions). On feature branches we only create insignificant versions based on the tag history of the commit the feature branch is created from. Here it is safe to assume that the insignificant version is safe because the parallel branch will have tags with increasing versions. So I think it seems fine to disable parallel branch logic for insignificant version inference. I am also thinking that reckon should forbid creating tags for insignificant versions (maybe it already does). |
0.17.0-beta.4 released with that change. Reckon for quite a while has prohibited tagging insignificant releases, so we're good there. |
I just played a bit with beta 4 and below is the result: You can see
|
After thinking about it, I feel like But the master branch, which is the default branch, must honor the I feel like master branch and feature branches should not behave the same because master branch is the default, working branch. On master branch insignificants must also apply parallel branch logic, otherwise it feels weird that a significant tag has a different base version ( I think reckon needs an option to ask for the default, working branch name. |
Sorry for the delay. I believe the inconsistency between I think all that's left then is the question of whether All else equal, reckon should produce a version reflective of the code present in the commit. Given that it's nearest normal version is 1.1.0 and it has three patch commits, it's appropriate that in this insignificant versioning phase it would merely use what it knows from tags and commit history and use Given the earlier change to make feature branches work more naturally, the Explicit first-class branch support isn't something I'm interested in adding to reckon. The nebula-release-plugin (which is a fork of the deprecated gradle-git release plugin that preceded reckon) does have explicit branch pattern support, so could be more intuitive to some. |
@ajoberstar I have changed reckon to use With that So my only critique is that That is why I proposed a single, additional configuration property that asks for a single branch name representing the main development branch. On that branch I understand your argument that |
Consider the following commit graph which I have used to test a workflow using reckon:
The reckon configuration is very basic:
The workflow can be described as:
dev
release to a small number of customers.dev
release is considered releasable and afinal
release is done. This can result in adev
andfinal
tag on the same commit.final
releases amaintenance/<major>.<minor>.x
branch will be created which is used for patch releasesfinal
releases are either done in themaintenance
branch and cherry picked intomaster
or the other way around.maintenance
branches and it's tags will be deleted if they are old enough and nobody uses that version anymoreNow as you can see in the above image I have started with a
1.0.0
release as a base point for reckon. Then somedev
releases has been made for some new features until1.1.0-dev.3
becomes a final release1.1.0
. Development continues and the next1.2.0-dev.1
release has been published.Now a critical bug has been discovered in
1.1.0
. A patch has been done on itsmaintenance/1.1.x
branch, a new release1.1.1
has been published and the patch has been cherry picked into master. A new1.2.0-dev.2
release has been done and that one also becomes the final release1.2.0
.So this worked pretty well because we have a new feature on master branch after the
1.1.0
release has been cut. Thus reckon switches to1.2.0-....
tags.Then I checked which tag reckon generates when only patches are on the master branch after release
1.2.0
has been cut. These patches are cherry picked from1.2.1
,1.2.2
and1.2.3
(maintenance branch).What irritates me is that reckon now chooses version
1.2.2-dev.0.3+3c73188
for a./gradlew build
on the latest master commit which seems like a bug to me, as it is based on a hotfix tag between other hotfix tags.I would have expected either
1.2.1-dev.0.3+<hash>
because it would be the next tag if only respect master branch tags. However this version would cause confusion as it conflicts with hotfix releases1.2.4-dev.0.3+<hash>
if reckon chooses to respect tags from other branches. However commit number is tough to choose in this scenario.I think the only real solution to that second scenario is to check if something like a release/maintenance/hotfix branch exists, and if it does, do a minor version bump even if only patch commits are on the master branch. This prevents overlapping versions and the minor version bump will happen anyways at some point once the first new feature has been committed to master.
To help implement such a check, reckon would need a configuration property telling it the prefix of such a release branch, e.g.
maintenance/
.The text was updated successfully, but these errors were encountered: