Skip to content

Commit e46daf5

Browse files
committed
Add a docs to the pipeline
Update the scan repo health expected output Signed-off-by: ziad hany <ziadhany2016@gmail.com>
1 parent 01eb611 commit e46daf5

7 files changed

Lines changed: 99 additions & 4 deletions

docs/application-settings.rst

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,55 @@ Also provide the name and email that will be used to sign off on commits to Git
419419

420420
FEDERATEDCODE_GIT_SERVICE_EMAIL=insert_email_here
421421

422+
.. _scancodeio_settings_grimoirelab:
423+
424+
GrimoireLab
425+
^^^^^^^^^^^^^
426+
427+
GrimoireLab is a platform for software development analytics and insights.
428+
429+
Before launching the GrimoireLab service, ensure that your GrimoireLab
430+
instance is version 2.x and that OpenSearch is running.
431+
432+
See https://github.com/chaoss/grimoirelab#getting-started for more details
433+
on the installation.
434+
435+
To configure your local environment, set the following in your ``.env`` file::
436+
437+
GRIMOIRELAB_METRICS_EXECUTABLE="./healthycode/venv/bin/grimoirelab-metrics"
438+
GRIMOIRELAB_URL="http://example.com:8000"
439+
GRIMOIRELAB_USERNAME="username"
440+
GRIMOIRELAB_PASSWORD="password"
441+
GRIMOIRELAB_OPENSEARCH_URL="https://example.com:9200"
442+
GRIMOIRELAB_OPENSEARCH_INDEX="events"
443+
GRIMOIRELAB_OPENSEARCH_USERNAME="opensearch_username"
444+
GRIMOIRELAB_OPENSEARCH_PASSWORD="opensearch_password"
445+
GRIMOIRELAB_ECOSYSTEM="npm-training-set"
446+
GRIMOIRELAB_PROJECT="npm-popular-components"
447+
448+
The following variables configure the connection to the GrimoireLab instance:
449+
450+
- ``GRIMOIRELAB_METRICS_EXECUTABLE``: Path to the grimoirelab-metrics executable, See
451+
here for more details on how to set up
452+
the grimoirelab-metrics executable: https://github.com/aboutcode-org/healthycode#installation
453+
454+
- ``GRIMOIRELAB_URL``: URL of the GrimoireLab instance.
455+
- ``GRIMOIRELAB_USERNAME``: Username used to authenticate with GrimoireLab.
456+
- ``GRIMOIRELAB_PASSWORD``: Password used to authenticate with GrimoireLab.
457+
458+
The following variables configure the connection to OpenSearch:
459+
460+
- ``GRIMOIRELAB_OPENSEARCH_URL``: URL of the OpenSearch instance.
461+
- ``GRIMOIRELAB_OPENSEARCH_INDEX``: OpenSearch index containing the GrimoireLab events.
462+
- ``GRIMOIRELAB_OPENSEARCH_USERNAME``: Username used to authenticate with OpenSearch.
463+
- ``GRIMOIRELAB_OPENSEARCH_PASSWORD``: Password used to authenticate with OpenSearch.
464+
465+
The following variables specify the GrimoireLab project where the project
466+
data is stored:
467+
468+
- ``GRIMOIRELAB_ECOSYSTEM``: Ecosystem containing the project data.
469+
- ``GRIMOIRELAB_PROJECT``: Name of the GrimoireLab project containing the project data.
470+
422471

423472
.. _scancodeio_settings_fetch_authentication:
424473

124 KB
Loading
177 KB
Loading

docs/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Learn via practical step-by-step guides.
4848
- :ref:`tutorial_web_ui_symbol_and_string_collection`
4949
- :ref:`tutorial_cli_end_to_end_scanning_to_dejacode`
5050
- :ref:`tutorial_analyze_symbols_reachability`
51+
- :ref:`tutorial_web_ui_scan_repo_health`
5152

5253
.. rst-class:: column column2 bottom-left
5354

@@ -118,6 +119,7 @@ Indices and tables
118119
tutorial_web_ui_symbol_and_string_collection
119120
tutorial_cli_end_to_end_scanning_to_dejacode
120121
tutorial_analyze_symbols_reachability
122+
tutorial_web_ui_scan_repo_health
121123
scanpipe-concepts
122124
built-in-pipelines
123125
custom-pipelines
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
.. _tutorial_web_ui_scan_repo_health:
2+
3+
Scan repo health (Web UI)
4+
=========================
5+
6+
This tutorial guides you through scanning the health
7+
of a git repository using the ScanCode.io Web UI.
8+
9+
.. note::
10+
This tutorial assumes you have a recent version of ScanCode.io installed
11+
locally on your machine and **running with Docker**.
12+
If you do not have it installed, see our :ref:`installation` guide for instructions.
13+
14+
Requirements
15+
------------
16+
17+
Before you follow the instructions in this tutorial, you need to:
18+
19+
- Install **ScanCode.io** locally.
20+
- Access to the web application from your preferred browser on http://localhost/ or
21+
http://localhost:8001/ if you run on a local development setup.
22+
- Make sure the following GrimoireLab
23+
service is correctly configured: :ref:`scancodeio_settings_grimoirelab`.
24+
25+
Instructions
26+
------------
27+
28+
1. From the homepage, click the ``New Project`` button.
29+
2. Enter ``npm-example-repo-health`` as the project **Name** for example.
30+
3. Add a valid git repository url into the **Download URL** field:
31+
https://github.com/aboutcode-org/npm-project-example
32+
4. Select ``scan_repo_health`` from the **Pipeline** dropdown.
33+
5. Check the **Execute pipeline now** box to run the pipeline immediately upon creation.
34+
6. Click **Create**.
35+
36+
.. image:: images/tutorial-web-ui-project-form-repo-health.png
37+
:alt: Create project form for repo health scan
38+
39+
7. Once the pipeline execution is complete, you can download the generated output result in
40+
**JSON** format (for example, ``metrics-2026-09-10-12-02-38.json``)
41+
or directly view the data from the project's result view.
42+
43+
.. image:: images/tutorial-web-ui-project-form-repo-health-result.png
44+
:alt: Scan repo health output pipeline

scanpipe/pipelines/scan_repo_health.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ def format_metrics_output(self):
166166

167167
result = {
168168
"repository": repository,
169-
"npm_health_score": score,
170-
"health_metrics": metrics,
169+
"score": score,
170+
"metrics": metrics,
171171
}
172172

173173
with open(self.metrics_output_path, "w") as f:

scanpipe/tests/data/grimorielab/expected-metrics.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"repository": "https://github.com/baidu/san.git",
3-
"npm_health_score": {
3+
"score": {
44
"value": 0.027432660614030716,
55
"metadata": {
66
"ecosystem": "npm",
77
"model": "health",
88
"version": "0.1"
99
}
1010
},
11-
"health_metrics": {
11+
"metrics": {
1212
"total_commits": 21,
1313
"total_contributors": 5,
1414
"total_organizations": 4,

0 commit comments

Comments
 (0)