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

sort according to VersionNumber comparator #697

Merged

Conversation

mawinter69
Copy link
Contributor

The file plugin-versions.json is the base for sorting the releases of a plugin on the plugins page at https://plugins.jenkins.io
The sorting with string causes wrong ordering in some cases as described in jenkins-infra/plugin-site#1336

By sorting with the Comparator of VersionNumber we get the same sorting as in other places.

the file plugin-versions.json is the base for sorting the releases of a
plugin on the plugins page at https://plugins.jenkins.io
The sorting with string causes wrong ordering in some cases as described
in jenkins-infra/plugin-site#1336

By sorting with the Comparator of VersionNumber we get the same sorting
as in other places.
@daniel-beck daniel-beck self-requested a review April 18, 2023 12:30
@daniel-beck
Copy link
Contributor

Thanks.

Originally added in daniel-beck@64d85c2, but I don't remember why I added the TODO instead of simply addressing it. My best guess is that I wanted to have identical output with the large-scale overhaul of the tool, given the bad test coverage, so kept the existing behavior, just noting it for later. I guess "later" is now.

@daniel-beck daniel-beck added the enhancement This is an enhancement for the tool or wrapper scripts, typically adding features. label Apr 18, 2023
@zbynek
Copy link
Contributor

zbynek commented Apr 18, 2023

This by itself won't be enough because plugin-site parses the JSON and sorts things independently (see e.g. https://github.com/jenkins-infra/plugin-site/pull/1297/files). Reusing ordering from update center would be great of coursem, but I'm not sure is a way to do that with the current JSON format. Unfortunatelly Object.keys in JS is mostly chronological, but with an exception for integers. And of course there is a plugin (gcr-scanner) where this would be a problem and version 1.0 would come after 2.

@daniel-beck
Copy link
Contributor

plugin-installation-manager-tool is another consumer, but it doesn't look like it cares about order: https://github.com/jenkinsci/plugin-installation-manager-tool/blob/f131bc53adab6015f39229ae4c3eca937f2bb92f/plugin-management-library/src/main/java/io/jenkins/tools/pluginmanager/impl/PluginManager.java#L891-L892 (looks like it's only used when installing a non-latest version of a plugin, and having to resolve its dependencies).

Copy link
Contributor

@zbynek zbynek left a comment

Choose a reason for hiding this comment

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

@daniel-beck please don't consider my comment blocking, I think this is an improvement, just needs a follow-up in plugin-site

@zbynek
Copy link
Contributor

zbynek commented Sep 2, 2023

@daniel-beck is there anything blocking merge of this PR?

@daniel-beck
Copy link
Contributor

@zbynek Nothing blocking this, except there was no real need for a new release AFAICT. Due to limited test coverage it's always a bit cumbersome to publish and use a new release, so I generally try to bundle up a bunch of changes. To make it easier to recover what those changes are (e.g. for the changelog) given the metadata is in the same repo and changes are far more numerous, I hold PRs until shortly before the intended release date.

daniel-beck added a commit to daniel-beck/update-center2 that referenced this pull request Mar 8, 2024
@daniel-beck daniel-beck merged commit f19d5a5 into jenkins-infra:master Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is an enhancement for the tool or wrapper scripts, typically adding features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants