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

Fix: Issue with the next development version logic. #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

doublefx
Copy link

@doublefx doublefx commented Apr 17, 2019

The next development version is computed by increment of one, for either the buildNumber when present or the patch version even when those one are set to zero.

The current logic does not allow us to use the patch version for hotfixes only.

For example, given a current development version 6.144.0-SNAPSHOT, if the logic is to increment the patch version, at release time, the plugin will propose 6.144.1-SNAPSHOT but I need 6.145.0-SNAPSHOT and I will have to manually update the next development version manually and that at every single release.

Now, if we change the logic to increment only when it is not zero, I only need to change the next development version when a major change is required, the rest of the time the desired version part will be incremented automatically.

A config parameter "org.jfrog.artifactory.releaseManagement.nextDevelopmentVersionStrategy" that can be set either in the build configuration and / or project configuration, so the nextDevelopmentVersionStrategy can use for only specific projects and / or builds.
When not set, set to "default" or set to unknown, the default nextDevelopmentVersionStrategy is used, when set to "ignore_zeros", it will apply that specific nextDevelopmentVersionStrategy.

The new logic would propose by default, given a strategy: release version ==> next development version :

UNKNOWN : 6.0.0 ==> 6.0.1-SNAPSHOT
UNKNOWN : 6.1.0 ==> 6.1.1-SNAPSHOT
UNKNOWN : 6.0.1 ==> 6.0.2-SNAPSHOT
UNKNOWN : 6.1.0-0 ==> 6.1.1-SNAPSHOT
UNKNOWN : 6.1.0-22 ==> 6.1.0-23-SNAPSHOT
UNKNOWN : 6.1 ==> 6.1.1-SNAPSHOT
UNKNOWN : 6 ==> 6.0.1-SNAPSHOT

DEFAULT : 6.0.0 ==> 6.0.1-SNAPSHOT
DEFAULT : 6.1.0 ==> 6.1.1-SNAPSHOT
DEFAULT : 6.0.1 ==> 6.0.2-SNAPSHOT
DEFAULT : 6.1.0-0 ==> 6.1.1-SNAPSHOT
DEFAULT : 6.1.0-22 ==> 6.1.0-23-SNAPSHOT
DEFAULT : 6.1 ==> 6.1.1-SNAPSHOT
DEFAULT : 6 ==> 6.0.1-SNAPSHOT

IGNORE_ZEROS : 6.0.0 ==> 7.0.0-SNAPSHOT
IGNORE_ZEROS : 6.1.0 ==> 6.2.0-SNAPSHOT
IGNORE_ZEROS : 6.0.1 ==> 6.0.2-SNAPSHOT
IGNORE_ZEROS : 6.1.0-0 ==> 6.2.0-SNAPSHOT
IGNORE_ZEROS : 6.1.0-22 ==> 6.1.0-23-SNAPSHOT
IGNORE_ZEROS : 6.1 ==> 6.2.0-SNAPSHOT
IGNORE_ZEROS : 6 ==> 7.0.0-SNAPSHOT

Everything works almost as before except for when the lowest version part is zero.

@jetersen
Copy link
Contributor

@doublefx
You might want to set up an email alias on your GitHub account 🥇
Or look into fixing your git user.email config 😅
to get proper credit for your commits 🏆
https://help.github.com/articles/adding-an-email-address-to-your-github-account/
https://help.github.com/articles/setting-your-commit-email-address-in-git
then to amend your commits: https://stackoverflow.com/a/3042512

@doublefx
Copy link
Author

doublefx commented Apr 17, 2019

arrf, you are right, I don't mind about the credit but mind about that Signed-off :-)
I will push again

@jetersen
Copy link
Contributor

The from inside the .patch says the same as Signed-off so 🤷‍♂️

@doublefx
Copy link
Author

Should be ok now.

@jetersen
Copy link
Contributor

The next development version is computed by increment of one, for either the buildNumber when present or the patch version even when those one are set to zero.

The current logic does not allow us to use the patch version for hotfixes only.

For example, given a current development version 6.144.0-SNAPSHOT, if the logic is to increment the patch version, at release time, the plugin will propose 6.144.1-SNAPSHOT but I need 6.145.0-SNAPSHOT and I will have to manually update the next development version manually and that at every single release.

Now, if we change the logic to increment only when it is not zero, I only need to change the next development version when a major change is required, the rest of the time the desired version part will be incremented automatically.

The new logic would propose by default, given a strategy: release version ==> next development version :

UNKNOWN : 6.0.0 ==> 6.0.1-SNAPSHOT
UNKNOWN : 6.1.0 ==> 6.1.1-SNAPSHOT
UNKNOWN : 6.0.1 ==> 6.0.2-SNAPSHOT
UNKNOWN : 6.1.0-0 ==> 6.1.1-SNAPSHOT
UNKNOWN : 6.1.0-22 ==> 6.1.0-23-SNAPSHOT
UNKNOWN : 6.1 ==> 6.1.1-SNAPSHOT
UNKNOWN : 6 ==> 6.0.1-SNAPSHOT

DEFAULT : 6.0.0 ==> 6.0.1-SNAPSHOT
DEFAULT : 6.1.0 ==> 6.1.1-SNAPSHOT
DEFAULT : 6.0.1 ==> 6.0.2-SNAPSHOT
DEFAULT : 6.1.0-0 ==> 6.1.1-SNAPSHOT
DEFAULT : 6.1.0-22 ==> 6.1.0-23-SNAPSHOT
DEFAULT : 6.1 ==> 6.1.1-SNAPSHOT
DEFAULT : 6 ==> 6.0.1-SNAPSHOT

IGNORE_ZEROS : 6.0.0 ==> 7.0.0-SNAPSHOT
IGNORE_ZEROS : 6.1.0 ==> 6.2.0-SNAPSHOT
IGNORE_ZEROS : 6.0.1 ==> 6.0.2-SNAPSHOT
IGNORE_ZEROS : 6.1.0-0 ==> 6.2.0-SNAPSHOT
IGNORE_ZEROS : 6.1.0-22 ==> 6.1.0-23-SNAPSHOT
IGNORE_ZEROS : 6.1 ==> 6.2.0-SNAPSHOT
IGNORE_ZEROS : 6 ==> 7.0.0-SNAPSHOT

Everything works almost as before except for when the lowest version part is zero.
@doublefx
Copy link
Author

Can you please check this new patch?
if ever it did not work I'll have to do it later and in another way.

@jetersen
Copy link
Contributor

you can always check yourself :) just click the commit and add .patch

Looks alright to me 😆

@doublefx
Copy link
Author

doublefx commented Apr 17, 2019

Good one, I did not know the trick, thanks.
Regarding the credit, I really don't care and won't take any, my github account is still set to my Apache email address, what I care though is not using my company email address ;-)

@jetersen
Copy link
Contributor

jetersen commented Apr 17, 2019

Well, you got the credit 😆 GitHub says so, it is based on your From line in the .patch
image

@eyalbe4
Copy link
Contributor

eyalbe4 commented Aug 25, 2019

@doublefx,
Thank you for working on this creating this pull request.

I think that introducing the concept of multiple strategies (DEFAULT, IGNORE_ZEROS and UNKNOWN) can cause some confusion. I'm not sure how easy it will be to explain each strategy and this will probably not satisfy all possible versioning requirements.

I suggest going for a simpler approach. Let me know what you think:

  1. Let's have the existing algorithm as default.
  2. Let's also allow setting an optional regular expression, with one capturing group, which will indicate which portion of the version to increments.

Examples:

[0-9]+.[0-9]+.([0-9]+)-SNAPSHOT --> Increment the patch version.
[0-9]+.([0-9]+).[0-9]+-SNAPSHOT --> Increment the minor version.

@CLAassistant
Copy link

CLAassistant commented Jun 11, 2020

CLA assistant check
All committers have signed the CLA.

@eyalbe4
Copy link
Contributor

eyalbe4 commented Aug 3, 2020

@doublefx,
Please let me know if you'd like to continue promoting this.

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

Successfully merging this pull request may close these issues.

4 participants