@@ -611,6 +611,9 @@ public final class Data {
611611 */
612612 public final String connectionCheckUrl ;
613613
614+ @ Restricted (NoExternalUse .class )
615+ public final boolean healthScoresAvailable ;
616+
614617 Data (JSONObject o ) {
615618 this .sourceId = Util .intern ((String ) o .get ("id" ));
616619 JSONObject c = o .optJSONObject ("core" );
@@ -649,6 +652,8 @@ public final class Data {
649652 }
650653 }
651654
655+ boolean healthScoresAvailable = false ;
656+
652657 for (Map .Entry <String , JSONObject > e : (Set <Map .Entry <String , JSONObject >>) o .getJSONObject ("plugins" ).entrySet ()) {
653658 Plugin p = new Plugin (sourceId , e .getValue ());
654659 // JENKINS-33308 - include implied dependencies for older plugins that may need them
@@ -662,6 +667,10 @@ public final class Data {
662667 }
663668 plugins .put (Util .intern (e .getKey ()), p );
664669
670+ if (p .healthScore != null ) {
671+ healthScoresAvailable = true ;
672+ }
673+
665674 // compatibility with update sites that have no separate 'deprecated' top-level entry.
666675 // Also do this even if there are deprecations to potentially allow limiting the top-level entry to overridden URLs.
667676 if (p .hasCategory ("deprecated" )) {
@@ -671,6 +680,8 @@ public final class Data {
671680 }
672681 }
673682
683+ this .healthScoresAvailable = healthScoresAvailable ;
684+
674685 connectionCheckUrl = (String ) o .get ("connectionCheckUrl" );
675686 }
676687
@@ -1256,6 +1267,12 @@ public final class Plugin extends Entry {
12561267 @ Restricted (NoExternalUse .class )
12571268 public IssueTracker [] issueTrackers ;
12581269
1270+ @ Restricted (NoExternalUse .class )
1271+ public final Integer healthScore ;
1272+
1273+ @ Restricted (NoExternalUse .class )
1274+ public final String healthScoreClass ;
1275+
12591276 @ DataBoundConstructor
12601277 public Plugin (String sourceId , JSONObject o ) {
12611278 super (sourceId , o , UpdateSite .this .url );
@@ -1292,6 +1309,12 @@ public Plugin(String sourceId, JSONObject o) {
12921309 int optionalDepCount = (int ) ja .stream ().filter (IS_DEP_PREDICATE .and (IS_NOT_OPTIONAL .negate ())).count ();
12931310 dependencies = getPresizedMutableMap (depCount );
12941311 optionalDependencies = getPresizedMutableMap (optionalDepCount );
1312+ this .healthScore = o .has ("health" ) ? o .getInt ("health" ) : null ;
1313+ if (healthScore != null ) {
1314+ this .healthScoreClass = PluginWrapper .getHealthScoreClassForScore (healthScore );
1315+ } else {
1316+ this .healthScoreClass = null ;
1317+ }
12951318
12961319 for (Object jo : o .getJSONArray ("dependencies" )) {
12971320 JSONObject depObj = (JSONObject ) jo ;
0 commit comments