-
Notifications
You must be signed in to change notification settings - Fork 144
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 Rocket's deb comparator to order artifact versions #429
Use Rocket's deb comparator to order artifact versions #429
Conversation
store(artifact, "fnord-2.1/builds/3") | ||
store(artifact, "fnord-1.0.0-41595c4") | ||
store(artifact, "fnord-2.0.0-608bd90") | ||
store(artifact, "fnord-2.1.0-18ed1dc") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slight concern that version always have to conform to a valid format in order for things to work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems fine to me... 🤷♀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this should no longer be a problem once I addressed @cfieber's suggestion to make the comparison null-safe
val version1_2 = "1.2" | ||
val version1 = "keeldemo-0.0.1~dev.8-h8.41595c4" | ||
val version2 = "keeldemo-0.0.1~dev.9-h9.3d2c8ff" | ||
val version3 = "keeldemo-0.0.1~dev.10-h10.1d2d542" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My pathological case
} | ||
|
||
test("versions are returned newest first") { | ||
expectThat(subject.versions(artifact1)).containsExactly(version3, version2, version1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test to see if sorting is correct
} | ||
|
||
fun Collection<String>.sortAppVersion() = | ||
sortedWith(VERSION_COMPARATOR.reversed()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes this available for use by whatever implementation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comments otherwise LGTM
@@ -0,0 +1,123 @@ | |||
package com.netflix.rocket.semver; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thoughts on calling this package com.netflix.rocket.semver.shaded
or something so if this becomes a class in its own library we can import without silent conflict?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems legit
|
||
private val debComparator = DebianVersionComparator() | ||
|
||
private fun String.toVersion() = AppVersion.parseName(this).version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if its like everything else in Frigga, AppVersion.parseName probably thoroughly enjoys returning null
I think the usage in compare needs to guard against null args (and maybe support null args) to honour the Comparator contract? unless this is some kotlin take on Comparator that sorts out null already
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's why I had to update the ArtifactControllerTests
to use valid-ish appversion strings. Guarding against this is a thoroughly good idea, though.
@@ -0,0 +1,123 @@ | |||
package com.netflix.rocket.semver.shaded; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this need to be in the "shaded" package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was @cfieber's suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh I see it now. Cool
…oji to master Squashed commit of the following: commit 4a7812c6e96da89bd9c8f342e1aad9a9a7af65c4 Author: Sihang Yu <[email protected]> Date: Thu Jul 22 10:33:27 2021 -0700 fix(notification): Use the correct emoji for pluginNotification PASS/FAIL (cherry picked from commit 2fa25613d1b8596c3adc255fa9ac89af47a48159)
…oji to master Squashed commit of the following: commit 4a7812c6e96da89bd9c8f342e1aad9a9a7af65c4 Author: Sihang Yu <[email protected]> Date: Thu Jul 22 10:33:27 2021 -0700 fix(notification): Use the correct emoji for pluginNotification PASS/FAIL (cherry picked from commit 2fa25613d1b8596c3adc255fa9ac89af47a48159)
…ster (#1978) Squashed commit of the following: commit 4a7812c6e96da89bd9c8f342e1aad9a9a7af65c4 Author: Sihang Yu <[email protected]> Date: Thu Jul 22 10:33:27 2021 -0700 fix(notification): Use the correct emoji for pluginNotification PASS/FAIL (cherry picked from commit 2fa25613d1b8596c3adc255fa9ac89af47a48159) Co-authored-by: Sihang Yu <[email protected]>
…oji to master Squashed commit of the following: commit 4a7812c6e96da89bd9c8f342e1aad9a9a7af65c4 Author: Sihang Yu <[email protected]> Date: Thu Jul 22 10:33:27 2021 -0700 fix(notification): Use the correct emoji for pluginNotification PASS/FAIL (cherry picked from commit 2fa25613d1b8596c3adc255fa9ac89af47a48159)
…oji to master (spinnaker#1978) Squashed commit of the following: commit 4a7812c6e96da89bd9c8f342e1aad9a9a7af65c4 Author: Sihang Yu <[email protected]> Date: Thu Jul 22 10:33:27 2021 -0700 fix(notification): Use the correct emoji for pluginNotification PASS/FAIL (cherry picked from commit 2fa25613d1b8596c3adc255fa9ac89af47a48159) Co-authored-by: Sihang Yu <[email protected]>
…oji to master (spinnaker#1978) Squashed commit of the following: commit 4a7812c6e96da89bd9c8f342e1aad9a9a7af65c4 Author: Sihang Yu <[email protected]> Date: Thu Jul 22 10:33:27 2021 -0700 fix(notification): Use the correct emoji for pluginNotification PASS/FAIL (cherry picked from commit 2fa25613d1b8596c3adc255fa9ac89af47a48159) Co-authored-by: Sihang Yu <[email protected]>
No description provided.