@@ -195,7 +195,7 @@ def get_latest_github_release(owner: str, repo: str) -> str | None:
195195]
196196
197197
198- def scan_stackablectl (secobserve_api_token : str ) -> None :
198+ def scan_stackablectl (secobserve_api_token : str , upload_sbom : Optional [ bool ] = False ) -> None :
199199 """Download and scan the latest stackablectl SBOMs from GitHub releases.
200200
201201 The stackable-cockpit project publishes CycloneDX SBOMs alongside each
@@ -245,7 +245,7 @@ def scan_stackablectl(secobserve_api_token: str) -> None:
245245 continue
246246 print (f"Converted { xml_path } to { json_path } " )
247247
248- scan_sbom (secobserve_api_token , json_name , "stackablectl" , version )
248+ scan_sbom (secobserve_api_token , json_name , "stackablectl" , version , upload_sbom = upload_sbom )
249249
250250
251251def _build_base_env (secobserve_api_token : str , product_name : str , branch_name : str ) -> dict :
@@ -330,6 +330,7 @@ def scan_sbom(
330330 file_name : str ,
331331 product_name : str ,
332332 branch_name : str ,
333+ upload_sbom : Optional [bool ] = False ,
333334) -> None :
334335 """Scan a local SBOM file using Trivy and Grype in SBOM mode.
335336
@@ -338,7 +339,7 @@ def scan_sbom(
338339 """
339340 env = _build_base_env (secobserve_api_token , product_name , branch_name )
340341 env ["TARGET" ] = f"/tmp/{ file_name } "
341- _run_combined_scan (env , "sbom" )
342+ _run_combined_scan (env , "sbom" , upload_sbom = upload_sbom )
342343
343344
344345_ARCH_SUFFIXES = ("-amd64" , "-arm64" )
@@ -359,7 +360,7 @@ def _filter_redundant_manifest_tags(tags: list[str]) -> list[str]:
359360 return [tag for tag in tags if tag not in arch_bases or tag .endswith (_ARCH_SUFFIXES )]
360361
361362
362- def scan_additional_images (secobserve_api_token : str ) -> None :
363+ def scan_additional_images (secobserve_api_token : str , upload_sbom : Optional [ bool ] = False ) -> None :
363364 """Scan additional images that are not part of the regular versioned Stackable release.
364365
365366 For each image the Harbor API is queried for tags pushed within the last
@@ -398,7 +399,7 @@ def scan_additional_images(secobserve_api_token: str) -> None:
398399
399400 for tag in tags :
400401 image = f"{ REGISTRY_URL } /{ project } /{ repository } :{ tag } "
401- scan_image (secobserve_api_token , image , product_name , tag )
402+ scan_image (secobserve_api_token , image , product_name , tag , upload_sbom = upload_sbom )
402403
403404
404405def main ():
@@ -546,13 +547,13 @@ def scan_release(secobserve_api_token: str, release: str, upload_sbom: Optional[
546547 # Scan additional infrastructure/third-party images using Harbor API tag discovery.
547548 # This runs once (not per-arch) because tags from Harbor include the arch suffix
548549 # already or are arch-agnostic manifests.
549- scan_additional_images (secobserve_api_token )
550+ scan_additional_images (secobserve_api_token , upload_sbom = upload_sbom )
550551
551552 # Scan the latest stackablectl binary from GitHub releases.
552553 # Only run for the dev release to avoid redundant scans when multiple releases
553554 # are processed in the same workflow run (stackablectl is release-independent).
554555 if release == DEV_RELEASE :
555- scan_stackablectl (secobserve_api_token )
556+ scan_stackablectl (secobserve_api_token , upload_sbom = upload_sbom )
556557
557558
558559def scan_image (
0 commit comments