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

[JENKINS-51594] Test behavior of snapshots vs. RCs, JEP-229 #6

Merged
merged 9 commits into from Apr 14, 2021

Conversation

jglick
Copy link
Member

@jglick jglick commented May 29, 2018

JENKINS-51594

See jenkinsci/jenkins#153 where @stephenc was apparently trying to act like Maven by default.

@@ -48,10 +48,6 @@
* <p>
* 'SNAPSHOT' is also allowed as a component, and "N.SNAPSHOT" is interpreted as "N-1.*"
*
* <pre>
* 2.0.* &lt; 2.0.1 &lt; 2.0.1-SNAPSHOT &lt; 2.0.0.99 &lt; 2.0.0 &lt; 2.0.ea &lt; 2.0
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was just so far off that I did not see how to rescue it. 2.0.1 < 2.0??

@jglick
Copy link
Member Author

jglick commented Jun 4, 2018

CC @oleg-nenashev @batmat

@oleg-nenashev oleg-nenashev self-requested a review June 6, 2018 15:37
@jglick jglick requested review from stephenc and batmat June 6, 2018 15:39
@@ -180,7 +176,7 @@ public String toString() {
* Represents a string in the version item list, usually a qualifier.
*/
private static class StringItem implements Item {
private final static String[] QUALIFIERS = {"snapshot", "alpha", "beta", "milestone", "rc", "", "sp"};
private final static String[] QUALIFIERS = {"alpha", "beta", "milestone", "rc", "snapshot", "", "sp"};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically from Maven's PoV -SNAPSHOT happens before -alpha-SNAPSHOT which happens before the release.

IOW your version starts off as 1.1-SNAPSHOT, then goes to 1.1-alpha-1-SNAPSHOT, 1.1-alpha-1, 1.1-alpha-2-SNAPSHOT, 1.1-alpha-2, 1.1-beta-1-SNAPSHOT, 1.1-beta-1, 1.1-rc-1-SNAPSHOT, 1.1-rc-1, ..., 1.1, 1.1-sp-1-SNAPSHOT, 1.1-sp-1, 1.1-sp-2-SNAPSHOT

So if you want to stay consistent with Maven's version handling, this is not the change you want

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm…I am wondering whether we should just be making this library a shim for ComparableVersion. It is not entirely clear to me why it differs at all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some "magic" that KK had for * as a version component

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw a comment to that effect…but is this “feature” actually being used anywhere that you know of?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know not of any usage of that...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm milestones are usually pre-alpha thus milestone -> alpha -> beta -> rc -> ga but yeah maven ¯_(ツ)_/¯

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jglick jglick requested a review from jtnord June 7, 2018 18:51
@batmat
Copy link
Member

batmat commented Feb 5, 2019

@jglick FYI this is now conflicted.
Do you plan to finish it?

@jglick
Copy link
Member Author

jglick commented Feb 6, 2019

this is now conflicted

Fixed.

Do you plan to finish it?

Well it was not “unfinished”, it was more that there was no clear consensus on what the behavior of this library should be or what the historical decisions were.

Copy link
Member

@jtnord jtnord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as per Stephenc.

changing the order of rc and snapshot whilst makes sense for our incrementals JEP (222?) it does not match mavens ordering and I am not clear on what if any issues that may cause.

As Snapshots are normally clearly identified and can be filtered this should not cause too many issues (famous last words), but I am not clear on where any checking would actually take place between a snapshot and a non snapshot version.

@@ -180,7 +176,7 @@ public String toString() {
* Represents a string in the version item list, usually a qualifier.
*/
private static class StringItem implements Item {
private final static String[] QUALIFIERS = {"snapshot", "alpha", "beta", "milestone", "rc", "", "sp"};
private final static String[] QUALIFIERS = {"alpha", "beta", "milestone", "rc", "snapshot", "", "sp"};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jglick
Copy link
Member Author

jglick commented Mar 1, 2021

it does not match mavens ordering

Right: #6 (comment)

jenkinsci/jenkins#3551 makes this less interesting.

@jglick jglick changed the title [JENKINS-51594] Snapshots should sort as newer than RCs [JENKINS-51594] Test behavior of snapshots vs. RCs Mar 1, 2021
@jglick jglick marked this pull request as ready for review March 1, 2021 21:21
@jglick jglick changed the title [JENKINS-51594] Test behavior of snapshots vs. RCs [JENKINS-51594] Test behavior of snapshots vs. RCs, JEP-229 Mar 1, 2021
@jglick jglick requested a review from daniel-beck March 1, 2021 21:26
@jglick jglick added the tests label Mar 1, 2021
// Maven considers 99.1.abcd1234abcd to sort before 99.1234deadbeef so we cannot simply use 99. as the branch prefix.
// Nor can we use 99.1234deadbeef. as the prefix because Maven would compare 5 and 10 lexicographically.
// 100._. seems to work but is not intuitive.
// Using changelist.format=%d.v%s behaves better, apparently because then the hash is never treated like a number.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jglick jglick requested review from jtnord and timja April 14, 2021 18:20
@jglick jglick merged commit 91593bd into jenkinsci:master Apr 14, 2021
@jglick jglick deleted the snapshots-JENKINS-51594 branch April 14, 2021 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants