Commit 575a2fed authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

Merge branch 'fix/allow-missing-vex-file' into 'main'

fix: gracefully handle missing VEX file

See merge request to-be-continuous/tools/dt-sbom-scanner!71
parents 0a135584 b4bc6fcb
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -747,11 +747,6 @@ class Scanner:
                sbom_file_prefix = sbom_file_path.name.split(".")[0]
                vex_file_path = sbom_file_path.with_name(f"{sbom_file_prefix}.vex.json")

                if self.upload_vex and not vex_file_path.exists():
                    fail(
                        f"- VEX file {AnsiColors.HRED}not found{AnsiColors.RESET}: {AnsiColors.HGRAY}{vex_file_path}{AnsiColors.RESET}"
                    )

                sbom = sbom_utils.load_bom(sbom_file_path)
                if self.merge:
                    sboms.append(sbom)
@@ -794,10 +789,6 @@ class Scanner:
                    merged_sbom, Path(self.merge_output), self.cdx_schema_version
                )
            vex_file_path = Path(self.merged_vex_file) if self.merged_vex_file else None
            if self.upload_vex and not vex_file_path.exists():
                fail(
                    f"- VEX file {AnsiColors.HRED}not found{AnsiColors.RESET}: {AnsiColors.HGRAY}{vex_file_path}{AnsiColors.RESET}"
                )

            self.publish(merged_sbom, "merged", vex_file_path)