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

Displaying of plugin health score in Search Page #1320

Merged
merged 15 commits into from
Apr 10, 2023

Conversation

Harsh3341
Copy link
Contributor

As "Displaying of Plugin Health Score" project idea has been withdrawn from the GSoC 2023.
So as said by @MarkEWaite we can still open a PR for a review of the implementation.

Though the project idea has been withdrawn its implementation can be useful to the developers using plugins and contributors have already researched and worked on some implementation of this idea, so together we can work on this idea.

Here is a small implementation of Displaying the Plugin Health Score on the Search Page for every plugin.

I have fetched the plugin health score data in link and added a separate component for Plugin Health Score in link

Here is the deployed website - https://deluxe-pixie-154589.netlify.app/

@halkeye @zbynek can you plz review it

@Harsh3341 Harsh3341 requested a review from a team as a code owner March 23, 2023 22:06
@zbynek
Copy link
Contributor

zbynek commented Mar 23, 2023

Happy to see progress on this, looks nice! Thanks for preparing the preview site, you didn't have to do that, there is a Netlify preview for each PR on this repo. Before we merge this, there should be some way to find out why did each plugin get that score value, ideally embeded into the plugin page. Agreed with @halkeye on the technical points. Also please fix the lint error mentioned here: https://ci.jenkins.io/blue/organizations/jenkins/Infra%2Fplugin-site/detail/PR-1320/2/pipeline -- it's useful to run yarn lint --fix before pushing each commit.

@Harsh3341
Copy link
Contributor Author

Collaborator

Sure I'm gonna work more on the mentioned technical part

@alecharp
Copy link
Contributor

Thank you @Harsh3341 to try to implement this even outside of the GSoC context!

I think (and it was my idea for the GSoC project) that it would be more efficient to have an API on Plugin Health Scoring which would provide the score of all plugins into one single file.
This would also match the behavior of other method fetching data from external services (plugin-version, update-center, etc), if I'm not mistaking.

I'm starting to work on something that could be reused for this. So, for now, you can use the API you are using, but I think the API I'm working on while help you with your implementation.

@NotMyFault
Copy link
Member

Thanks for your efforts, even if this idea has been withdrawn from GSoC '23. This PR is a great start, and hopefully, one of a few, to display health scores.

@Harsh3341
Copy link
Contributor Author

Thanks, @alecharp it will be great if you starting to build an API that provides overall data even probes that ran on the plugin to obtain the score, It will be helpful to present a detailed explanation on the plugin's health score page.

I raised this PR so that building of frontend UI of this idea can be started with the current data we have, further with the new API we can make those changes

@Harsh3341
Copy link
Contributor Author

@zbynek @halkeye can you please review the latest commit #f6f0642

@zbynek
Copy link
Contributor

zbynek commented Mar 26, 2023

@Harsh3341 it's not adding healthScore to Algolia index, the other improvements look good.

@Harsh3341
Copy link
Contributor Author

@Harsh3341 it's not adding healthScore to Algolia index, the other improvements look good.

I thought of Algolia , is it necessary to add helathScore to algolia index? currently searching is done through algolia , I think which is not required for healthScore right now.

Looking forward while adding filtering based on healthScore which will be done while solving issue #632 there might we need to add healthScore to algolia index🤔

@zbynek
Copy link
Contributor

zbynek commented Mar 26, 2023

It might seem inefficient to send the score to Algolia and back even if search does not use it, but since the site is staticaly generated it makes sense. Though it's not a big difference (1 number for ~2000 plugins is just a few kilobytes), loading the data from GraphQL means you have to load the score of all plugins each time you display the search page, even if the search result has just a few results.

@Harsh3341
Copy link
Contributor Author

Thanks @zbynek I got it, and I will consider it this change may lead to better performance

@Harsh3341
Copy link
Contributor Author

@zbynek @halkeye I have added healthScore to the Algolia index but with these keys, I'm getting the error "Index PluginsHealthScore does not exist"
const searchClient = algoliasearch( process.env.GATSBY_ALGOLIA_APP_ID || 'HF9WKP9QU1', process.env.GATSBY_ALGOLIA_SEARCH_KEY || '4ef9c8513249915cc20e3b32c450abcb' );

but in my local development, I have used my keys in the .env file and it's working perfectly

why is this happening?

@Harsh3341
Copy link
Contributor Author

yea, i'm just waiting for formatting to be fixed, and a basic test for utils to be added.

Is there any reference I should take to write a test? It's totally new for me to write test cases.

@halkeye
Copy link
Member

halkeye commented Apr 9, 2023

oh wow the current tests have grown large. https://github.com/jenkins-infra/plugin-site/blob/master/plugins/gatsby-source-jenkinsplugins/utils.test.js#L44 would be an example though.

nock() the external call (mock a network call, nock), then call your function.
Don't need to confirm everything is right, Mostly we want a .json file with an example response from the healthcheck service just so in months from now, when something changed, we can compare results. we can expand the test later.

@Harsh3341
Copy link
Contributor Author

Thanks for the help @halkeye @zbynek I hope work has been done for displaying health scores on the search page

@halkeye
Copy link
Member

halkeye commented Apr 10, 2023

lgtm lets ship it!

@halkeye halkeye merged commit cbe92b8 into jenkins-infra:master Apr 10, 2023
@NotMyFault
Copy link
Member

:shipit:

@Harsh3341
Copy link
Contributor Author

lgtm lets ship it!

🚀

@halkeye
Copy link
Member

halkeye commented Apr 10, 2023

@Harsh3341 when you are in a happy state (if you want to do any followup PRs and stuff). I recommend posting to https://community.jenkins.io/c/using-jenkins/showing-off/9

@Harsh3341
Copy link
Contributor Author

@zbynek @halkeye can't we revert this merge as it's not a good idea to display healthScore without its explanation.
I'm going to come with follow-up PRs for further implementation as mentioned in #1320 (comment)

After completing the next implementations we can merge them.

@MarkEWaite
Copy link
Contributor

@zbynek @halkeye can't we revert this merge as it's not a good idea to display healthScore without its explanation.
I'm going to come with follow-up PRs for further implementation as mentioned in #1320 (comment)

I think it is much better to show the score than to not show the score. A lower score may persuade users to avoid an outdated plugin or a plugin with known security issues.

@NotMyFault
Copy link
Member

Reverting is not needed, simply file a follow-up PR with further adjustments.
It's much easier to build consensus on smaller changes, rather than on one large on, not to mention bigger PRs typically come with a much longer review time.

We don't mind delivering things in parts :)

@Harsh3341
Copy link
Contributor Author

Thought about a small implementation until a bigger implementation is made

Search Results _ Jenkins plugin - Google Chrome 11-04-2023 21_00_16

adding an info link beside Health Score which on click redirects to the https://plugin-health.jenkins.io/scores/${plugin_name}

Search Results _ Jenkins plugin - Google Chrome 11-04-2023 21_00_24

What's your thought on this small change for some time?

@NotMyFault
Copy link
Member

Thought about a small implementation until a bigger implementation is made

Search Results _ Jenkins plugin - Google Chrome 11-04-2023 21_00_16

adding an info link beside Health Score which on click redirects to the https://plugin-health.jenkins.io/scores/${plugin_name}

Search Results _ Jenkins plugin - Google Chrome 11-04-2023 21_00_24

What's your thought on this small change for some time?

Having a PR up with the changes proposed is the best way to gain feedback for it.

@alecharp
Copy link
Contributor

Thank you all for this work! I have an updated API which I will likely merge soon and release. See jenkins-infra/plugin-health-scoring#286.

With this, we would have details about the score (what contributed to the score). I can include more details (let me know in the PR). We can also use the statistics values to change the bar color (red for less than firstQuartile, orange for less than median, yellow for less than thirdQuartile and green for more than thirdQuartile for example.

@halkeye
Copy link
Member

halkeye commented Apr 12, 2023

What's your thought on this small change for some time?

I think that sounds good.

It should be easier to iterate now that the data is there and in algolia

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.

6 participants