Skip to content
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

Working with multiple release branches #102

Closed
ctolkmit opened this issue Oct 18, 2018 · 5 comments
Closed

Working with multiple release branches #102

ctolkmit opened this issue Oct 18, 2018 · 5 comments
Labels

Comments

@ctolkmit
Copy link

Hi,

either I am confused about using this plugin in a useful way with multiple release Branches.

Scenario:

My reckon config is:

reckon {
    scopeFromProp()
    stageFromProp('dev', 'rc', 'final')
}

I have got a project containing two Branches release/3.0.x and release 3.1.x. There are still branches release/2.0.x and release/2.1.x without using reckon, and existing tags like 2.0.7 (released, final versions) on the release/2.0.x branch.

In both 3.x branches I (manually) tagged (different) commits as 3.0.0-dev.0 and 3.1.0-dev.0 respectively.

When developing on both branches, reckon now determines useful versions like 3.0.0-dev.0.535+586704e.

I now created a release for branch 3.0.x: ./gradlew -Preckon.stage=rc reckonTagCreate
That correctly created: 3.0.0-rc.1

I now switch to my release/3.1.x branch and start a build, the following happens:

$ ./gradlew clean

FAILURE: Build failed with an exception.

* Where:
Build file '/home/ctolkmit/ennit-sal-ws/mime-main/app-modules/build.gradle' line: 24

* What went wrong:
A problem occurred evaluating project ':app-modules'.
> Reckoned version 2.1.0-dev.0.537+3c310d9 is (and cannot be) less than base version 3.1.0-dev.0

Git log's latest tag is 3.1.0.dev:

ctolkmit@inferno:~/ennit-sal-ws/mime-main$ git log --oneline
3c310d95 (HEAD -> release/3.1.x) SMIME-434 testing releases
4bdd229c (tag: 3.1.0-dev.0, origin/release/3.1.x) SMIME-434 added foobar
586704e3 (tag: 3.0.0-rc.1, origin/release/3.0.x, release/3.0.x) SMIME-434 try reckon again
10688ab1 (tag: 3.0.0-dev.0, feature/SMIME-434-umstellung-edelivery-auf-die-verwendung-von-git) SMIME-434 release branch suffix is optional
fa68c2aa SMIME-434 fix release branch pattern
0ee1baeb SMIME-434 update nebula-release-plugin
e02e7ca0 (origin/feature/SMIME-434-umstellung-edelivery-auf-die-verwendung-von-git) SMIME-434 fix release branch pattern
3c62f3c7 SMIME-434 limit release branch patterns
c8acd537 SMIME-434 add nebula plugin
3e766165 Merge remote-tracking branch 'origin/release/2.1.x' into feature/SMIME-434-umstellung-edelivery-auf-die-verwendung-von-git
581fdb1c (origin/release/2.1.x) Merge pull request #261 in SHUS/mime-main from bugfix/SMIME-439-merge-to-2.1.0 to release/2.1.x
bb064c3d Merge pull request #262 in SHUS/mime-main from bugfix/SMIME-437-FROM-2.1 to release/2.1.x
07f6c2fd (release/2.1.x) fix tab content for action view

So - what am I doing wrong? Or is this the expected behavior? We really need to develop two Releases (or even more) in parallel. Would love to use reckon ....

@ajoberstar
Copy link
Owner

I think this is a weakness of the current parallel branch handling. If you tried to develop a release/2.2.x branch, it would correctly skip 2.1.0 which is being developed elsewhere and give you 2.2.0, because they use the same scope to increment from the base 2.0.0 version. Since you want to do major, minor instead of minor, minor, it doesn't work.

Seems like a bug, though I'd have to think through how this could be resolved.

@ajoberstar ajoberstar added the bug label Nov 4, 2018
@sdavids13
Copy link

For some reason Reckon doesn't seem to infer the correct version when using release branches. For example, I have a tag of 0.1.0, then created a branch: release/0.1.x but when reckoning the version on that branch it bumps the version to 0.2.0-dev.1 instead of the expected 0.1.1-dev.1. The old gradle-git and the nebula-release plugin seems to do the right thing. I am curious if I am missing something somehow, I haven't seen anything in the documentation to say if it is supported or not.

@ajoberstar
Copy link
Owner

@sdavids13 The old gradle-git plugin had a concept of branch patterns that would let you coerce/hint to the plugin that you have a particular normal version in mind for this branch. Currently, reckon doesn't look at branch name at all. There are some conceptual benefits to keeping it generic, but it makes it hard to handle this kind of use case.

If you wouldn't mind opening a separate issue, I think something tied to either branch names or you being able to provide hints of the version like -Dreckon.pattern=0.1.x (and some equivalent programmatic API might let people mix and match this without reckon needing to know the branch (though that's still an option too).

@ajoberstar
Copy link
Owner

@ctolkmit Finally taking a look at this, here's what I think is going on:

  • The 2.0.7 release (or some 2.0.x release) is in the history of release/3.0.x and release/3.1.x
  • The 3.0.0-dev.0 tag hinted to reckon that you were working on a major version in release/3.0.x, so your -Preckon.stage=rc ended up with 3.0.0-rc.1
  • The 3.1.0-dev.0 tag is more than one major/minor/patch increment away from 2.0.7 tag, so reckon considers this an invalid increment and falls back to minor. I'm changing this to a more explicit error in the next version to make this easier to see.

One of the big issues here is that I'm purely looking at commit history and not branch names (as mentioned above). This is partly because some CI systems don't preserve branch names properly at all times, and also it avoids having to know what your naming convention is.

An assumption reckon makes is that you have to have contiguous version numbers (e.g. you can't jump from 2.0.7 to 3.1.0 since it requires a major jump then a minor jump).

It might help to see your log with the --graph flag to provide a better picture of your history. If 3.0.0-rc.1 is in the history of release/3.1.x I could see some potential options for inferring this correctly. Otherwise, I think reckon wouldn't have any way to identify this without understanding branch names.

ajoberstar added a commit that referenced this issue Aug 14, 2022
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
ajoberstar added a commit that referenced this issue Aug 14, 2022
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
ajoberstar added a commit that referenced this issue Aug 14, 2022
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
@ajoberstar
Copy link
Owner

I think the approach used to solve #180 (see #181 for description, released in 0.17.0-beta.1) will resolve many of the parallel version use cases. Not positive about this specific one, but would appreciate any feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants