- 
                Notifications
    
You must be signed in to change notification settings  - Fork 55
 
RHIDP-8709: Scorecard plugin #1465
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
base: main
Are you sure you want to change the base?
Changes from all commits
1ef0338
              b184dc4
              f055631
              6fb43a4
              bd38785
              e6db041
              7fedd71
              5ddfe0b
              04e84b7
              3330ca1
              68b7285
              63f2e82
              3835cb9
              fd3b987
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [IMPORTANT] | ||
| ==== | ||
| This section describes Developer Preview features in the Scorecard plugin. Developer Preview features are not supported by Red Hat in any way and are not functionally complete or production-ready. Do not use Developer Preview features for production or business-critical workloads. Developer Preview features provide early access to functionality in advance of possible inclusion in a Red Hat product offering. Customers can use these features to test functionality and provide feedback during the development process. Developer Preview features might not have any documentation, are subject to change or removal at any time, and have received limited testing. Red Hat might provide ways to submit feedback on Developer Preview features without an associated SLA. | ||
| For more information about the support scope of Red Hat Developer Preview features, see https://access.redhat.com/support/offerings/devpreview/[Developer Preview Support Scope]. | ||
| ==== | 
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,14 @@ | ||||||
| :_mod-docs-content-type: ASSEMBLY | ||||||
| 
     | 
||||||
| [id="assembly-configuring-scorecards-in-rhdh"] | ||||||
| = Configuring Scorecards to view metrics in your {product} instance | ||||||
| :context: assembly-configuring-scorecards-in-rhdh | ||||||
| 
     | 
||||||
| You can configure one of the following Scorecards in your {product-very-short} instance using metrics and scoring capabilities from various data sources for software components in the {product-very-short} catalog: | ||||||
| 
         Check warning on line 7 in assemblies/assembly-configuring-scorecards-in-rhdh.adoc 
    
   | 
||||||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are now also installing. You can install both. 
        Suggested change
       
    
  | 
||||||
| 
     | 
||||||
| * GitHub Scorecards | ||||||
| * Jira Scorecards | ||||||
| 
     | 
||||||
| include::modules/observe/scorecards/proc-configuring-github-scorecards-in-rhdh-instance.adoc[leveloffset=+1] | ||||||
| 
     | 
||||||
| include::modules/observe/scorecards/proc-configuring-jira-scorecards-in-rhdh-instance.adoc[leveloffset=+1] | ||||||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| :_mod-docs-content-type: ASSEMBLY | ||
| 
     | 
||
| [id="assembly-rhdh-observability"] | ||
| = Understanding and visualizing {product} project health using Scorecards | ||
| :context: assembly-scorecards-rhdh | ||
| 
     | 
||
| include::modules/observe/scorecards/con-understand-scorecard-plugins.adoc[leveloffset=+1] | ||
| 
     | 
||
| include::modules/observe/scorecards/con-supported-metrics-providers.adoc[leveloffset=+2] | ||
| 
     | 
||
| include::assembly-setting-up-scorecards-to-monitor-your-rhdh-health.adoc[leveloffset=+1] | ||
| 
     | 
||
| include::assembly-configuring-scorecards-in-rhdh.adoc[leveloffset=+1] | ||
| 
     | 
||
| include::modules/observe/scorecards/con-manage-metric-thresholds-in-scorecard-plugin.adoc[leveloffset=+1] | ||
| 
     | 
||
| include::modules/observe/scorecards/con-how-thresholds-work.adoc[leveloffset=+2] | ||
| 
     | 
||
| include::modules/observe/scorecards/ref-supported-threshold-expressions.adoc[leveloffset=+2] | ||
| 
     | 
||
| include::modules/observe/scorecards/ref-threshold-rules-to-metrics-for-scorecard-plugin.adoc[leveloffset=+2] | ||
| 
     | 
||
| include::modules/observe/scorecards/con-set-global-standards-for-metric-thresholds.adoc[leveloffset=+2] | ||
| 
     | 
||
| include::modules/observe/scorecards/ref-override-rules-to-configure-entity-specific-thresholds.adoc[leveloffset=+2] | ||
| 
     | 
||
| include::modules/observe/scorecards/con-best-practices-for-threshold-rules.adoc[leveloffset=+2] | ||
| 
     | 
||
| include::modules/observe/scorecards/proc-viewing-scorecards-in-rhdh.adoc[leveloffset=+1] | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| :_mod-docs-content-type: ASSEMBLY | ||
| 
     | 
||
| [id="assembly-setting-up-scorecards-to-monitor-your-rhdh-health"] | ||
| = Setting up Scorecards to monitor your {product} project health | ||
| :context: assembly-setting-up-scorecards-to-monitor-your-rhdh-health | ||
| 
     | 
||
| include::modules/observe/scorecards/proc-installing-scorecard-plugin-in-rhdh-instance.adoc[leveloffset=+1] | ||
| 
     | 
||
| include::modules/observe/scorecards/proc-authenticating-and-managing-scorecard-plugins.adoc[leveloffset=+1] | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| :_mod-docs-content-type: CONCEPT | ||
| 
     | 
||
| [id="con-best-practices-for-threshold-rules"] | ||
| = Best practices for threshold rules | ||
| 
     | 
||
| Threshold rule evaluation is order-dependent. You must follow logical ordering to avoid unintended category assignments, as the system stops evaluation once a value matches the first rule. | ||
| 
     | 
||
| == Follow logical ordering | ||
| 
     | 
||
| Rules must be sequenced logically. Order rules from the most strict (smallest range) to the least strict (largest range) or ensure all ranges are mutually exclusive. | ||
| 
     | 
||
| === Problematic Rule Order Example | ||
| 
     | 
||
| If rules are ordered incorrectly, a less restrictive rule can prevent stricter rules from being evaluated: | ||
| 
     | 
||
| . `warning: <50`: Any value less than 50 triggers the warning rule and stops evaluation. | ||
| . `success: <10`: This rule is not evaluated because all values less than 10 already matched the preceding warning rule. | ||
| 
     | 
||
| === Correct Ordering Example | ||
| 
     | 
||
| Order the rules from the most restrictive value range to the least restrictive to ensure logical flow. | ||
| 
     | 
||
| [source,yaml] | ||
| ---- | ||
| # Correct Example: Order from most restrictive (Success) to least restrictive (Error) | ||
| rules: | ||
| - key: success | ||
| expression: '<10' # Only values below 10 | ||
| - key: warning | ||
| expression: '10-50' # Only values between 10 and 50 | ||
| - key: error | ||
| expression: '>50' # All remaining values above 50 | ||
| ---- | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| :_mod-docs-content-type: CONCEPT | ||
| 
     | 
||
| [id="con-how-thresholds-work_{context}"] | ||
| = How Thresholds work | ||
| 
     | 
||
| A threshold defines a condition or an expression that determines which visual category a metric value belongs to. | ||
| 
     | 
||
| * Evaluation Order: Threshold rules are evaluated in the order they are defined. The first matching rule is applied to the metric value. | ||
| * Allowed Categories: Only three keys are supported: `success`, `warning`, and `error`. | ||
| * Best Practice: Always order rules from the most restrictive to the least restrictive to ensure logical assignment. | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| :_mod-docs-content-type: CONCEPT | ||
| 
     | 
||
| [id="con-manage-metric-thresholds-in-scorecard-plugin_{context}"] | ||
| = Managing metric thresholds in your Scorecard plugin | ||
| 
     | 
||
| The Scorecard plugin uses thresholds to translate raw metric values into visual health indicators (`Success`, `Warning`, or `Error`). Configuring these thresholds is the primary way platform engineers and developers define what constitutes a healthy component. | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| :_mod-docs-content-type: CONCEPT | ||
| 
     | 
||
| [id="con-set-global-standards-to-configure-thresholds"] | ||
| = Set global standards for metric thresholds | ||
| 
     | 
||
| To override the default thresholds set by a metric provider, you must update your `{product-very-short} app-config.yaml` file under the configuration path of the specific metric. | ||
| 
     | 
||
| The custom configuration completely replaces the provider's defaults. If you omit a threshold category (such as `success`), that category is not assigned. | ||
| 
     | 
||
| The following configuration defines a `success` threshold as 10 or fewer issues, which applies to all components using the `jira.open_issues` metric unless explicitly overridden by an entity annotation. | ||
| 
     | 
||
| [source,yaml] | ||
| ---- | ||
| scorecard: | ||
| plugins: | ||
| jira: | ||
| open_issues: | ||
| thresholds: | ||
| rules: | ||
| - key: success | ||
| expression: '<10' # fewer than 10 open issues is Success | ||
| - key: warning | ||
| expression: '10-50' # Between 10 and 50 is a Warning | ||
| - key: error | ||
| expression: '>50' # More than 50 open issues is an Error | ||
| ---- | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| :_mod-docs-content-type: CONCEPT | ||
| 
     | 
||
| [id="con-supported-metric-providers_{context}"] | ||
| = Supported metric providers in {product} | ||
| 
     | 
||
| The Scorecard plugin collects metrics from third-party data sources using metric providers. The Scorecard node plugin provides the `scorecardMetricsExtensionPoint` extension point that is used to connect your backend plugin module that exports custom metrics via metric providers to the Scorecard backend plugin. | ||
| 
     | 
||
| The following metric providers are available: | ||
| 
     | 
||
| [cols="1,1,2,3,1", options="header"] | ||
| |=== | ||
| | Provider | Metric ID | Title | Description | Type | ||
| 
     | 
||
| | GitHub | ||
| | `github.open_prs` | ||
| | GitHub open PRs | ||
| | Count of open Pull Requests in GitHub | ||
| | number | ||
| 
     | 
||
| | Jira | ||
| | `jira.open_issues` | ||
| | Jira open issues | ||
| | The number of opened issues in Jira | ||
| | number | ||
| |=== | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| :_mod-docs-content-type: CONCEPT | ||
| 
     | 
||
| [id="con-understand-scorecard-plugin_{context}"] | ||
| = Understand Scorecard plugins in {product} | ||
| 
     | 
||
| include::{docdir}/artifacts/snip-developer-preview-scorecard.adoc[] | ||
| 
     | 
||
| The Scorecard plugin offers comprehensive, customizable insights into the health, security posture, and compliance of your components, services, and APIs. It centralizes Key Performance Indicators (KPIs) within {product} ({product-very-short}), so you do not have to consult multiple external systems. | ||
| 
     | 
||
| image::rhdh/scorecard-sample.png[] | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| :_mod-docs-content-type: PROCEDURE | ||
| 
     | 
||
| [id="proc-authenticating-and-managing-scorecard-plugins_{context}"] | ||
| = Authenticating and managing Scorecard plugins to control who sees the metrics | ||
| 
     | 
||
| As an administrator, you can secure the connection to your metric providers by managing user access to the Scorecards using the Role-Based Access Control (RBAC) permissions. For users to view the Scorecard metrics, you must provide users with read access to the Scorecard metrics. You can configure these permissions either by modifying your RBAC csv file directly or by using the RBAC Web UI. | ||
| 
     | 
||
| .Prerequisite | ||
| * You have {authorization-book-link}#enabling-and-giving-access-to-rbac[enabled RBAC, have a policy administrator role in Developer Hub, and have added scorecard to plugins with permission]. | ||
| 
     | 
||
| .Procedure | ||
| . Set the required RBAC permissions using any of the following methods: | ||
| ** To use the csv file, in your csv file, you can directly add the following code: | ||
| + | ||
| [source,yaml] | ||
| ---- | ||
| g, user:default/<YOUR_USERNAME>, role:default/scorecard-viewer | ||
| p, role:default/scorecard-viewer, scorecard.metric.read, read, allow | ||
| p, role:default/scorecard-viewer, catalog.entity.read, read, allow | ||
| ---- | ||
| See {authorization-book-link}#ref-rbac-permission-policies_title-authorization[Permission policies reference]. | ||
| 
     | 
||
| ** To use the RBAC Web UI, complete the following steps: | ||
| ... In your {product} menu, go to *Administration > RBAC*. | ||
| ... Select or create the *Role* to which you want to grant access to the Scorecards. | ||
| ... To enable read access for the Scorecard plugin, in *Add permission policies*, select *Scorecard* from the plugins dropdown. | ||
| ... Expand *Scorecard*, select *policy* with the following details, and click *Next*: | ||
| **** *Name*: `scorecard.metric.read` | ||
| **** *Permission*: `read` | ||
| 
     | 
||
| image::rhdh/scorecard-create-role.png[] | 
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,124 @@ | ||||||
| :_mod-docs-content-type: PROCEDURE | ||||||
| 
     | 
||||||
| [id="proc-configuring-github-scorecards-in-rhdh-instance_{context}"] | ||||||
| = Configuring GitHub Scorecards to view GitHub metrics in your {product} instance | ||||||
| 
     | 
||||||
| You can view GitHub metrics for software components registered in the {product-very-short} catalog. To allow the {product-very-short} to access the GitHub API, you must create a GitHub App and configure the necessary integration. | ||||||
| 
     | 
||||||
| .Prerequisites | ||||||
| 
     | 
||||||
| * You have installed your {product-very-short} instance. | ||||||
| * You have {scorecard-plugin-book-link}#proc-installing-scorecard-plugin-in-rhdh-instance[installed the Scorecard images]. | ||||||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.  | 
||||||
| * You must have permissions in GitHub to create and manage a https://docs.github.com/en/apps/overview[GitHub App]. | ||||||
| * You must have {configuring-book-link}[added a custom {product-very-short} application configuration] and have enough permissions to change it. | ||||||
| 
     | 
||||||
| .Procedure | ||||||
| To configure GitHub Scorecards in your RHDH instance, complete the following steps: | ||||||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 
        Suggested change
       
    
  | 
||||||
| 
     | 
||||||
| . To allow {product-very-short} to access the GitHub API, you must create and configure a GitHub App and add the necessary integration to your configuration file by completing the following steps: | ||||||
| .. Create a https://docs.github.com/en/apps/overview[GitHub App] with the required permissions (Read-only for Contents to allow reading repositories). | ||||||
| .. Generate a client secret and a private key. | ||||||
| .. Install the app on the desired account/organization. | ||||||
| .. Save the following values: | ||||||
| *** `App ID` | ||||||
| *** `Client ID` | ||||||
| *** `Client secret` | ||||||
| *** `Private key` | ||||||
| .. Add your GitHub credentials to {configuring-book-link}#provisioning-your-custom-configuration[your {product-very-short} secrets] using the following key/value pairs. You can use these secrets in the {product-very-short} configuration files by using their respective environment variable names. | ||||||
| *** `GITHUB_INTEGRATION_APP_ID` | ||||||
| *** `GITHUB_INTEGRATION_CLIENT_ID` | ||||||
| *** `GITHUB_INTEGRATION_CLIENT_SECRET` | ||||||
| *** `GITHUB_INTEGRATION_HOST_DOMAIN` (e.g., `github.com`) | ||||||
| *** `GITHUB_INTEGRATION_PRIVATE_KEY_FILE` | ||||||
| 
     | 
||||||
| . Configure the GitHub integration in your `{product-very-short} {my-app-config-file}`, by adding the `integrations.github` section: | ||||||
| + | ||||||
| [source,yaml] | ||||||
| ---- | ||||||
| integrations: | ||||||
| github: | ||||||
| - host: ${GITHUB_INTEGRATION_HOST_DOMAIN} | ||||||
| apps: | ||||||
| - appId: ${GITHUB_INTEGRATION_APP_ID} | ||||||
| clientId: ${GITHUB_INTEGRATION_CLIENT_ID} | ||||||
| clientSecret: ${GITHUB_INTEGRATION_CLIENT_SECRET} | ||||||
| privateKey: | | ||||||
| ${GITHUB_INTEGRATION_PRIVATE_KEY_FILE} | ||||||
| ---- | ||||||
| 
     | 
||||||
| . Add the catalog ingest entity by adding the `catalog` section in your `{product-very-short} {my-app-config-file}` | ||||||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 
        Suggested change
       
    
 Also, please move this step after you introduce the file for the first time => after this . In your {product-very-short} entity that you want to configure for the GitHub Scorecard plugin, in the   | 
||||||
| + | ||||||
| [source,yaml] | ||||||
| ---- | ||||||
| catalog: | ||||||
| locations: | ||||||
| - type: url | ||||||
| target: https://github.com/owner/repo/catalog-info.yaml | ||||||
| ---- | ||||||
| 
     | 
||||||
| . Configure the GitHub Scorecard plugin in your `{product-very-short} dynamic-plugins-config.yaml` by adding the following code to your `{product-very-short} dynamic-plugins-config.yaml`: | ||||||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 
        Suggested change
       
    
  | 
||||||
| + | ||||||
| [source,yaml] | ||||||
| ---- | ||||||
| plugins: | ||||||
| - package: oci://ghcr.io/redhat-developer/rhdh-plugin-export-overlays/red-hat-developer-hub-backstage-plugin-scorecard-backend-module-github:bs_1.42.5__1.0.0!red-hat-developer-hub-backstage-plugin-scorecard-backend-module-github | ||||||
| disabled: false | ||||||
| ---- | ||||||
| 
     | 
||||||
| . In your {product-very-short} entity that you want to configure for the GitHub Scorecard plugin, in the `catalog-info.yaml` file, link a component to the data source by adding the required annotations as shown in the following code: | ||||||
| + | ||||||
| [source,yaml] | ||||||
| ---- | ||||||
| apiVersion: backstage.io/v1alpha1 | ||||||
| kind: Component | ||||||
| metadata: | ||||||
| name: my-service | ||||||
| annotations: | ||||||
| # Required: GitHub project slug in format "owner/repository" | ||||||
| github.com/project-slug: myorg/my-service | ||||||
| # Required: Entity source location | ||||||
| backstage.io/source-location: url:https://github.com/myorg/my-service | ||||||
| spec: | ||||||
| type: service | ||||||
| lifecycle: production | ||||||
| owner: _<your_team_name>_ | ||||||
| ---- | ||||||
| + | ||||||
| where: | ||||||
| 
     | 
||||||
| `annotations:github.com/project-slug`:: The GitHub repository format, for example, `owner/repository`. | ||||||
| `annotations:backstage.io/source-location`:: The entity source location format, for example, `url:https://github.com/owner/repository`. | ||||||
| `spec:owner`:: Your team name. | ||||||
| + | ||||||
| [NOTE] | ||||||
| ==== | ||||||
| You must add the team entity to the Catalog to ensure the provided permissions are applicable. | ||||||
| ==== | ||||||
| 
     | 
||||||
| . (Optional) Configure metric threshold values. | ||||||
| 
     | 
||||||
| .. To customize the thresholds for the **GitHub Open Pull Requests** (`github.open_prs`) metric, add the following section to your `{my-app-config-file}` file: | ||||||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.  | 
||||||
| + | ||||||
| [source,yaml] | ||||||
| ---- | ||||||
| scorecard: | ||||||
| plugins: | ||||||
| github: | ||||||
| open_prs: | ||||||
| thresholds: | ||||||
| rules: | ||||||
| - key: success | ||||||
| expression: '<10' | ||||||
| - key: warning | ||||||
| expression: '10-50' | ||||||
| - key: error | ||||||
| expression: '>50' | ||||||
| ---- | ||||||
| where: | ||||||
| 
     | 
||||||
| `scorecard:plugins:github:open_prs:thresholds`:: Lists the default threshold values for the GitHub open PRs metric. | ||||||
| 
     | 
||||||
| [NOTE] | ||||||
| ==== | ||||||
| To read more information about how to customize the threshold values, see link:https://documentation.example.com/scorecard-plugins-thresholds/[Thresholds in Scorecard plugins]. | ||||||
| ==== | ||||||


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.
Now when we moved the installation of jira and githubb scorecards to their respective sections, I think the titles should reflect that.