-
Notifications
You must be signed in to change notification settings - Fork 24
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
Update process should check version and not allow reversion through update #765
Conversation
Relevant wildfly-channel issue that I think we would need implemented there in order to complete this functionality: |
A good next step could be to obtain a list of manifests used by the current installation. I think it should be possible to obtain maven GAVs (or URLs) of the current manifests. If there are any Maven based manifest found in the list, they should be matched against the list of new manifests (which the user want to upgrade to) used by the ChannelSession. (That list of new manifests is currently simulated by the |
Hello @TomasHofman, |
62b52fb
to
955a431
Compare
Now can we get the list of manifests currently used by the installation? Maybe from the InstallationMetadata class? If we can have that, we can try to obtain an intersection from those two lists (manifests groupId:artifactId s that are present in both currently installed manifest and the newly available manifests used by the channelSession). Once we have that intersection, we can try to compare the versions to see if they are upgrading or downgrading. |
@TomasHofman |
if (updateArtifact != null) { | ||
// Compare versions | ||
String installedVersion = installedManifest.getVersion(); | ||
String availableVersion = updateArtifact.getVersion(); | ||
|
||
if (installedVersion.compareTo(availableVersion) < 0) { | ||
System.out.println("Upgrade available for " + installedManifest.getArtifactId() + ": " + installedVersion + " -> " + availableVersion); | ||
} else if (installedVersion.compareTo(availableVersion) > 0) { | ||
System.out.println("Downgrade detected for " + installedManifest.getArtifactId() + ": " + installedVersion + " -> " + availableVersion); |
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.
I think the comparison logic here should not be an alphabetic comparison, but something that understands semantic versioning.
The problem is that e.g. version "1.11" would be evaluated as lower than "1.2" when using alphabetical ordering, while it should be higher semantically.
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.
Thanks for noticing it @TomasHofman
I have updated the code where I am using DefaultArtifactVersion where we compare the versions semantically.
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.
org.wildfly.channel.version.VersionMatcher
has the correct version compare logic
} | ||
|
||
// For each intersecting manifest, compare the version | ||
for (ManifestVersionRecord.MavenManifest installedManifest : intersectingManifests) { |
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.
you don't need the intersectingManifest
list. Just iterate over mavenManifests. You're already ignoring ones that are not in updateArtifacts
.
5c837cd
to
83e7704
Compare
The CI/CD is failing because we need wildfly-channel upgrade for the API. |
Yes, we must ask Jeff to release. |
Never mind, he did and you upgraded already. |
6fb4887
to
3af3f0e
Compare
@spyrkob currently this only checks for downgrade in the |
Maybe we could move the check into |
If the base server changes from the state that the candidate was generated from, that candidate is no longer valid and cannot be applied. |
1921899
to
9e0511f
Compare
Thanks @parsharma I added a few things to your changes in #784. I'll close this PR and merge the new one |
Issue: #759