Skip to content

Conversation

@tdruez
Copy link
Contributor

@tdruez tdruez commented Nov 12, 2025

Changes:

  • Move the {user_hash} from the project name to a project label
  • Check if a Scan is already available before submitting a scan request to ScanCode.io (instead of handling the error post-submit)

The submitting project name evolves:

  • from {uri_hash}.{dataspace_hash}.{user_hash}
  • to {uri_hash}.{dataspace_hash} + {user_hash} added as a label on the project.

Data migration

The following script can be applied to the ScanCode.io instance side if you wish to support the "Created by me" filter feature on the "Scan list" for old scans:

$ ./manage.py shell

from scanpipe.models import Project
from django.db.utils import IntegrityError

projects = (
    Project.objects.filter(
        runs__pipeline_name__in=["scan_single_package"],
        name__regex=r"^[a-f0-9]{10}\.[a-f0-9]{10}\.[a-f0-9]{10}$",
    )
)

for project in projects:
    parts = project.name.split('.')
    # Join all parts except the last one as the new name
    new_name = '.'.join(parts[:-1])
    try:
        project.update(name=new_name)
    except IntegrityError:
        continue
    # Get the last part as label
    label_value = parts[-1]
    project.labels.add(label_value)

@tdruez tdruez merged commit 0b5ba7c into main Nov 12, 2025
4 checks passed
@tdruez tdruez deleted the 387-scan-user-id branch November 12, 2025 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant