hooks/install: Make failure to find download location non-fatal Sometimes builds fail because it can't find package download location. It is a flaky issue but damages the stability of our builds. Since download location is not required by the EO, it would be better to make the failure non-fatal. BUG=b/280086674 TEST=presubmit RELEASE_NOTE=None Change-Id: I0765b38048d24197a2ce10ca0b3ab3172490de37 Reviewed-on: https://cos-review.googlesource.com/c/third_party/platform/crosutils/+/48589 Reviewed-by: Dexter Rivera <riverade@google.com> Tested-by: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
diff --git a/hooks/install/gen-sbom-package-info.py b/hooks/install/gen-sbom-package-info.py index 38948dd..989197f 100755 --- a/hooks/install/gen-sbom-package-info.py +++ b/hooks/install/gen-sbom-package-info.py
@@ -26,6 +26,7 @@ SBOM_INFO_FILE_NAME = "sbom-pkg-info.json" +SPDX_NOASSERTION = "NOASSERTION" class SbomPackageInfo: @@ -110,8 +111,10 @@ ) = licenses.get_licenses(build_info_dir, src_path, package_name) sbom_pkg_info.go_dep = go_dep.get_go_dep(src_path) + # Since download location is not required by the EO, failure to + # find download location shouldn't be fatal. if not sbom_pkg_info.download_url and not sbom_pkg_info.private: - raise SBOMPkgInfoError(f"download url not found") + sbom_pkg_info.download_url = SPDX_NOASSERTION if not sbom_pkg_info.licenses: sbom_pkg_info.licenses = "NONE" except Exception as e: