Skip to content

Commit 601201b

Browse files
committed
Merge remote-tracking branch 'origin/scorecard_integration' into scorecard_integration
2 parents 3baeac3 + e2eaadf commit 601201b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1541
-349
lines changed

CHANGELOG.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
Changelog
22
=========
33

4+
v34.9.6 (unreleased)
5+
--------------------
6+
7+
- Rename the ``docker``, ``docker_windows``, and ``root_filesystem`` modules to
8+
``analyze_docker``, ``analyze_docker_windows``, and ``analyze_root_filesystem``
9+
for consistency.
10+
11+
- Refine and document the Webhook system
12+
https://github.com/aboutcode-org/scancode.io/issues/1587
13+
* Add UI to add/delete Webhooks from the project settings
14+
* Add a new ``add-webhook`` management command
15+
* Add a ``add_webhook`` REST API action
16+
* Add a new ``SCANCODEIO_GLOBAL_WEBHOOK`` setting
17+
* Add a new chapter dedicated to Webhooks management in the documentation
18+
* Add support for custom payload dedicated to Slack webhooks
19+
420
v34.9.5 (2025-02-19)
521
--------------------
622

@@ -15,6 +31,14 @@ v34.9.5 (2025-02-19)
1531
with other aboutcode submodules.
1632
https://github.com/aboutcode-org/scancode.io/issues/1423
1733

34+
- Add a ``add-webhook`` management command that allows to add webhook subscription on
35+
a project.
36+
https://github.com/aboutcode-org/scancode.io/issues/1587
37+
38+
- Add proper progress logging for the ``assemble`` section of the
39+
``scan_for_application_packages``.
40+
https://github.com/aboutcode-org/scancode.io/issues/1601
41+
1842
v34.9.4 (2025-01-21)
1943
--------------------
2044

aboutcode/pipeline/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## Release 0.2.1 (February 24, 2025)
4+
5+
* Include the ``optional_step`` steps in the ``get_graph()`` list.
6+
[Issue #1599](https://github.com/aboutcode-org/scancode.io/issues/1599)
7+
38
## Release 0.2.0 (November 21, 2024)
49

510
* Refactor the ``group`` decorator for pipeline optional steps as ``optional_step``.

aboutcode/pipeline/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
module_logger = logging.getLogger(__name__)
3333

34-
__version__ = "0.2.0"
34+
__version__ = "0.2.1"
3535

3636

3737
class PipelineDefinition:
@@ -97,7 +97,7 @@ def get_graph(cls):
9797
"doc": getdoc(step),
9898
"groups": getattr(step, "groups", []),
9999
}
100-
for step in cls.get_steps()
100+
for step in cls.get_steps(groups=cls.get_available_groups())
101101
]
102102

103103
@classmethod

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ services:
2222
command: wait-for-it --strict --timeout=60 db:5432 -- sh -c "
2323
./manage.py migrate &&
2424
./manage.py collectstatic --no-input --verbosity 0 --clear &&
25-
gunicorn scancodeio.wsgi:application --bind :8000 --timeout 600 --workers 8 ${GUNICORN_RELOAD_FLAG}"
25+
gunicorn scancodeio.wsgi:application --bind :8000 --timeout 600 --workers 8 ${GUNICORN_RELOAD_FLAG:-}"
2626
env_file:
2727
- docker.env
2828
expose:

docs/application-settings.rst

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,54 @@ The web server can be started in DEBUG mode with:
268268
269269
$ SCANCODEIO_LOG_LEVEL=DEBUG make run
270270
271+
.. _scancodeio_settings_site_url:
272+
273+
SCANCODEIO_SITE_URL
274+
^^^^^^^^^^^^^^^^^^^
275+
276+
The base URL of the ScanCode.io application instance.
277+
This setting is **required** to generate absolute URLs referencing objects within the
278+
application, such as in webhook notifications.
279+
280+
The value should be a fully qualified URL, including the scheme (e.g., ``https://``).
281+
282+
Example configuration in the ``.env`` file::
283+
284+
SCANCODEIO_SITE_URL=https://scancode.example.com/
285+
286+
Default: ``""`` (empty)
287+
288+
.. _scancodeio_settings_global_webhook:
289+
290+
SCANCODEIO_GLOBAL_WEBHOOK
291+
^^^^^^^^^^^^^^^^^^^^^^^^^
292+
293+
This setting defines a **global webhook** that will be automatically added as a
294+
``WebhookSubscription`` for each new project.
295+
296+
The webhook is configured as a dictionary and must include a ``target_url``.
297+
Additional options control when the webhook is triggered and what data is included
298+
in the payload.
299+
300+
Example configuration in the ``.env`` file::
301+
302+
SCANCODEIO_GLOBAL_WEBHOOK=target_url=https://webhook.url,trigger_on_each_run=False,include_summary=True,include_results=False
303+
304+
The available options are:
305+
306+
- ``target_url`` (**required**): The URL where the webhook payload will be sent.
307+
- ``trigger_on_each_run`` (**default**: ``False``): If ``True``, the webhook is triggered
308+
on every pipeline run.
309+
- ``include_summary`` (**default**: ``False``): If ``True``, a summary of the pipeline
310+
run results is included in the payload.
311+
- ``include_results`` (**default**: ``False``): If ``True``, detailed scan results
312+
are included in the payload.
313+
314+
If this setting is provided, ScanCode.io will create a webhook subscription
315+
**only for newly created projects that are not clones**.
316+
317+
Default: ``{}`` (no global webhook is set)
318+
271319
TIME_ZONE
272320
^^^^^^^^^
273321

docs/built-in-pipelines.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,23 @@ Pipeline Base Class
2626

2727
Analyse Docker Image
2828
--------------------
29-
.. autoclass:: scanpipe.pipelines.docker.Docker()
29+
.. autoclass:: scanpipe.pipelines.analyze_docker.Docker()
3030
:members:
3131
:member-order: bysource
3232

3333
.. _pipeline_analyze_root_filesystem:
3434

3535
Analyze Root Filesystem or VM Image
3636
-----------------------------------
37-
.. autoclass:: scanpipe.pipelines.root_filesystem.RootFS()
37+
.. autoclass:: scanpipe.pipelines.analyze_root_filesystem.RootFS()
3838
:members:
3939
:member-order: bysource
4040

4141
.. _analyze_windows_docker_image:
4242

4343
Analyse Docker Windows Image
4444
----------------------------
45-
.. autoclass:: scanpipe.pipelines.docker_windows.DockerWindows()
45+
.. autoclass:: scanpipe.pipelines.analyze_docker_windows.DockerWindows()
4646
:members:
4747
:member-order: bysource
4848

docs/command-line-interface.rst

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,47 @@ add the docker pipeline to your project::
344344
``--pipeline map_deploy_to_develop:Java,JavaScript``
345345

346346

347+
.. _cli_add_webhook:
348+
349+
`$ scanpipe add-webhook --project PROJECT TARGET_URL`
350+
-----------------------------------------------------
351+
352+
Adds a webhook subscription to a project.
353+
354+
Required arguments:
355+
356+
- ``target-url``
357+
The target URL to which the webhook should send POST requests.
358+
359+
Optional arguments:
360+
361+
- ``--trigger-on-each-run``
362+
Trigger the webhook after each individual pipeline run.
363+
364+
- ``--include-summary``
365+
Include summary data in the payload.
366+
367+
- ``--include-results``
368+
Include results data in the payload.
369+
370+
- ``--inactive``
371+
Create the webhook but set it as inactive.
372+
373+
Example usage:
374+
375+
1. Add an active webhook that triggers after each pipeline run::
376+
377+
$ scanpipe add-webhook my_project https://example.com/webhook --trigger-on-each-run
378+
379+
2. Add a webhook that includes summary and results data::
380+
381+
$ scanpipe add-webhook my_project https://example.com/webhook --include-summary --include-results
382+
383+
3. Add an inactive webhook::
384+
385+
$ scanpipe add-webhook my_project https://example.com/webhook --inactive
386+
387+
347388
`$ scanpipe execute --project PROJECT`
348389
--------------------------------------
349390

docs/data-models.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,44 @@ Project
1414
:undoc-members:
1515
:member-order: groupwise
1616

17+
.. _data_models_codebase_resource:
18+
1719
CodebaseResource
1820
----------------
1921
.. autoclass:: scanpipe.models.CodebaseResource()
2022
:members:
2123
:undoc-members:
2224
:member-order: groupwise
2325

26+
.. _data_models_discovered_package:
27+
2428
DiscoveredPackage
2529
-----------------
2630
.. autoclass:: scanpipe.models.DiscoveredPackage()
2731
:members:
2832
:undoc-members:
2933
:member-order: groupwise
3034

35+
.. _data_models_discovered_dependency:
36+
3137
DiscoveredDependency
3238
--------------------
3339
.. autoclass:: scanpipe.models.DiscoveredDependency()
3440
:members:
3541
:undoc-members:
3642
:member-order: groupwise
3743

44+
.. _data_models_codebase_relation:
45+
3846
CodebaseRelation
3947
----------------
4048
.. autoclass:: scanpipe.models.CodebaseRelation()
4149
:members:
4250
:undoc-members:
4351
:member-order: groupwise
4452

53+
.. _data_models_project_message:
54+
4555
ProjectMessage
4656
--------------
4757
.. autoclass:: scanpipe.models.ProjectMessage()

docs/faq.rst

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,21 @@ Also, A new GitHub action is available at
205205
`scancode-action repository <https://github.com/nexB/scancode-action>`_
206206
to run ScanCode.io pipelines from your GitHub Workflows.
207207

208+
How can I get notified about my project progression?
209+
-----------------------------------------------------
210+
211+
You can monitor your project's progress in multiple ways:
212+
213+
- **User Interface:** The project details page provides real-time updates on pipeline
214+
execution.
215+
- **REST API:** Use the API to programmatically check the status of your projects.
216+
- **CLI Monitoring:** The ``scanpipe list-projects`` command provides an overview of
217+
project states.
218+
- **Webhook Integration:** You can set up webhooks to receive updates in your preferred
219+
notification system. For more details, refer to the :ref:`webhooks` section.
220+
- **Slack notifications:** Get project updates directly in Slack by configuring an
221+
incoming webhook. See :ref:`webhooks_slack_notifications` for setup instructions.
222+
208223
.. _faq_tag_input_files:
209224

210225
How to tag input files?
@@ -307,6 +322,39 @@ data older than 7 days::
307322
command.
308323

309324
How can I provide my license policies?
310-
---------------------------------------
325+
--------------------------------------
311326

312327
For detailed information about the policies system, refer to :ref:`policies`.
328+
329+
Can you analyze Dockerfiles?
330+
----------------------------
331+
332+
We have code in https://github.com/aboutcode-org/container-inspector/blob/main/src/container_inspector/dockerfile.py
333+
for this ... but this may not be wired in other tools at the moment.
334+
It can for instance map dockerfile instructions to actual docker image history,
335+
https://github.com/aboutcode-org/container-inspector/blob/main/src/container_inspector/dockerfile.py#L204
336+
337+
Can you analyze a built image? (Build Docker Image Analysis)
338+
------------------------------------------------------------
339+
340+
Yes, we do this in ScanCode.io. We have one fairly unique feature to actually account
341+
for all files used in all layers.
342+
343+
Can you analyze all layers of a running container?
344+
--------------------------------------------------
345+
346+
ScanCode.io scans all layers of images. We can scan all layers of a running container
347+
if you save the running container as an image first.
348+
We can also fetch images from registries, local files and technically also from a
349+
running container, say in a local docker ... but this has not yet been tested so far.
350+
We do not introspect k8s clusters to analyze the deployed and running images
351+
there (yet) and that would be a nice future addition.
352+
For now we can instead work on the many images there, save and analyze them.
353+
354+
Can you analyze Docker in Docker?
355+
---------------------------------
356+
357+
The input to ScanCode is a local saved image: Docker or OCI.
358+
Docker in Docker support will demand to have access to the saved images
359+
(either extracted from the Docker images in Docker, or mounted in a volume or saved
360+
from the Docker in the Docker image). Once saved we can analyze these alright.
-57.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)