Skip to content

Adding projects through the API runs all groups #1426

Closed
@AyanSinhaMahapatra

Description

@AyanSinhaMahapatra

Sending the following scan to a scancode.io instance triggers a scan with all the groups of the selected pipeline:

import requests

api_url = "http://localhost/api/projects/"
data = {
    "name": "worksbench_via_api",
    "input_urls": "https://github.com/aboutcode-org/scancode-workbench/archive/refs/tags/v4.0.3.tar.gz",
    "pipeline": "inspect_packages",
    "execute_now": True,
}
response = requests.post(api_url, data=data)
response.json()

From the log:

2024-10-31 14:48:35.585 Pipeline [inspect_packages] starting
2024-10-31 14:48:35.587 Step [download_missing_inputs] starting
2024-10-31 14:48:35.588 Fetching input from https://github.com/aboutcode-org/scancode-workbench/archive/refs/tags/v4.0.3.tar.gz
2024-10-31 14:48:40.984 Step [download_missing_inputs] completed in 5 seconds
2024-10-31 14:48:40.986 Step [copy_inputs_to_codebase_directory] starting
2024-10-31 14:48:41.013 Step [copy_inputs_to_codebase_directory] completed in 0 seconds
2024-10-31 14:48:41.016 Step [extract_archives] starting
2024-10-31 14:48:42.888 Step [extract_archives] completed in 2 seconds
2024-10-31 14:48:42.891 Step [collect_and_create_codebase_resources] starting
2024-10-31 14:48:44.034 Step [collect_and_create_codebase_resources] completed in 1 seconds
2024-10-31 14:48:44.036 Step [flag_empty_files] starting
2024-10-31 14:48:44.040 Step [flag_empty_files] completed in 0 seconds
2024-10-31 14:48:44.043 Step [flag_ignored_resources] starting
2024-10-31 14:48:44.044 Step [flag_ignored_resources] completed in 0 seconds
2024-10-31 14:48:44.046 Step [scan_for_application_packages] starting
2024-10-31 14:48:44.156 Progress: 10% (44/440) ETA: 1 seconds
2024-10-31 14:48:44.172 Progress: 20% (88/440)
2024-10-31 14:48:44.192 Progress: 30% (132/440)
2024-10-31 14:48:44.219 Progress: 40% (176/440)
2024-10-31 14:48:44.246 Progress: 50% (220/440)
2024-10-31 14:48:44.273 Progress: 60% (264/440)
2024-10-31 14:48:44.311 Progress: 70% (308/440)
2024-10-31 14:48:44.360 Progress: 80% (352/440)
2024-10-31 14:48:44.403 Progress: 90% (396/440)
2024-10-31 14:48:49.462 Progress: 100% (440/440)
2024-10-31 14:50:45.416 Step [scan_for_application_packages] completed in 121 seconds (2.0 minutes)
2024-10-31 14:50:45.418 Step [resolve_dependencies] starting
2024-10-31 14:51:56.518 Step [resolve_dependencies] completed in 71 seconds (1.2 minutes)
2024-10-31 14:51:56.521 Pipeline completed in 201 seconds (3.3 minutes)

We can see that the resolve_dependencies step is run, even though the StaticResolver group in inspect_packages pipeline is optional.

There is also no clear way to select groups when starting a project from the API:
It's not possible to choose groups like it is done via the CLI: "pipeline": "inspect_packages:StaticResolver", is not supported. It returns: {'pipeline': ['"inspect_packages:StaticResolver" is not a valid choice.']}

We also do not see the selected groups correctly in the pipeline run modal when scan is triggered from the API, as in the above case, pipeline steps from the StaticResolver group is run, but this is not visible in the modal, but only in the log.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions