Skip to content

Conversation

GilbN
Copy link
Member

@GilbN GilbN commented Oct 4, 2025

New

  • Adds methods for retrieving SBOM from manifest, will fall back to use syft if it fails.

    • make_sbom
    • get_sbom_syft
    • get_sbom_buildx_blob
    • parse_buildx_sbom
    • format_package_table
  • Added tests for new methods.

    • test_parse_buildx_sbom
    • test_format_package_table
    • test_get_sbom_buildx_blob
    • test_make_sbom

Changed

  • Moved repeating hardcoded values into enum classes.

    • CITests
    • CITestResult
    • CIReportResult
    • Platform
  • Deprecated generate_sbom

@GilbN GilbN linked an issue Oct 4, 2025 that may be closed by this pull request
1 task
@LinuxServer-CI
Copy link
Contributor

I am a bot, here is the pushed image/manifest for this PR:

ghcr.io/linuxserver/lspipepr-ci:94587082-pkg-94587082-dev-376ec12146cf982d0a83e6434311903d776cc781-pr-66

@GilbN GilbN requested a review from aptalca October 4, 2025 15:35
@LinuxServer-CI LinuxServer-CI moved this from PRs to PRs Ready For Team Review in Issue & PR Tracker Oct 4, 2025
@GilbN GilbN requested review from thelamer, thespad and Copilot October 4, 2025 15:36
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new SBOM (Software Bill of Materials) generation approach that attempts to retrieve SBOM data directly from image manifests using Docker buildx imagetools before falling back to the existing Syft-based method. The changes also refactor hardcoded strings into enum classes for better maintainability.

  • Adds new SBOM generation methods that prioritize manifest-based retrieval over container scanning
  • Introduces enum classes for CI test names, results, and platforms to replace hardcoded strings
  • Deprecates the existing generate_sbom method in favor of the new make_sbom approach

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ci/ci.py Core implementation of new SBOM methods and enum classes for better code organization
tests/test_ci.py Updated tests to use new enum classes and added comprehensive test coverage for new SBOM methods
tests/sbom_buildx_formatted_blob.txt Test fixture containing formatted SBOM output for validation
test_build.py Updated to use new enum classes for consistent status handling
Dockerfile Added docker-buildx-plugin dependency required for new SBOM functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

ci/ci.py Outdated
badge.write_badge(f"{self.outdir}/badge.svg", overwrite=True)
with open(f"{self.outdir}/ci-status.yml", "w", encoding="utf-8") as file:
file.write(f"CI: '{self.report_status}'")
file.write(f"CI: '{self.report_status.value}'\n")
Copy link

Copilot AI Oct 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The newline character should be removed from this line. The original code without the newline was correct, and adding it may cause issues with YAML parsing if this file is meant to be consumed as valid YAML.

Suggested change
file.write(f"CI: '{self.report_status.value}'\n")
file.write(f"CI: '{self.report_status.value}'")

Copilot uses AI. Check for mistakes.

ci/ci.py Outdated
"""
start_time = time.time()
sbom: str | CITestResult = self.get_sbom_buildx_blob(tag)
if isinstance(sbom, str) and sbom != CITestResult.ERROR:
Copy link

Copilot AI Oct 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comparison is incorrect. sbom is a string but CITestResult.ERROR is an enum instance. The comparison should be sbom != CITestResult.ERROR.value to compare the string value.

Suggested change
if isinstance(sbom, str) and sbom != CITestResult.ERROR:
if isinstance(sbom, str) and sbom != CITestResult.ERROR.value:

Copilot uses AI. Check for mistakes.

@LinuxServer-CI
Copy link
Contributor

I am a bot, here is the pushed image/manifest for this PR:

ghcr.io/linuxserver/lspipepr-ci:94587082-pkg-94587082-dev-b94d2b209602aed3c6d568643ad0ac723c6d57b9-pr-66

@thespad thespad changed the base branch from master to develop October 4, 2025 20:15
@LinuxServer-CI
Copy link
Contributor

I am a bot, here is the pushed image/manifest for this PR:

ghcr.io/linuxserver/lspipepr-ci:develop-94587082-pkg-94587082-dev-3cc85ec720522aeab2b5a60c31bd3500edcf5a8c-pr-66

@thespad
Copy link
Member

thespad commented Oct 7, 2025

Depends on linuxserver/docker-jenkins-builder#352 now so we can properly test across a range of images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: PRs Ready For Team Review
Development

Successfully merging this pull request may close these issues.

[FEAT] Retrieve SBOM from image manifest if it exists
3 participants