| Message ID | 20261204183008.1948784-1-esa.jaaskela@suomi24.fi |
|---|---|
| State | New |
| Headers | show |
| Series | sbom-cve-check: Read the SBOM through IMAGE_LINK_NAME if it is set | expand |
diff --git a/meta/classes-recipe/sbom-cve-check.bbclass b/meta/classes-recipe/sbom-cve-check.bbclass index 451595f1d7..3a9fb39df6 100644 --- a/meta/classes-recipe/sbom-cve-check.bbclass +++ b/meta/classes-recipe/sbom-cve-check.bbclass @@ -14,9 +14,9 @@ python do_sbom_cve_check() { """ Task: Run sbom-cve-check analysis on SBOM. """ - sbom_path = d.expand("${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.spdx.json") image_name = d.getVar("IMAGE_NAME") link_name = d.getVar("IMAGE_LINK_NAME") + sbom_path = d.expand("${DEPLOY_DIR_IMAGE}/%s.spdx.json" % (link_name or image_name)) run_sbom_cve_check(d, sbom_path, image_name, link_name) }
If the image content stays constant and only the CVE databases change, which the AUTOREV in the sbom-cve-check fragment makes common, the do_sbom_cve_check task runs again in a new build while do_create_image_sbom_spdx task is not re-run. This in turn results in a failure, as an SBOM with the full IMAGE_NAME containing the timestamp cannot be found. Read the SBOM through the ${IMAGE_LINK_NAME}.spdx.json link if it is set. It points to the SBOM of the latest do_create_image_sbom_spdx run. Fall back to ${IMAGE_NAME}.spdx.json if IMAGE_LINK_NAME is empty. Signed-off-by: Esa Jaaskela <esa.jaaskela@suomi24.fi> --- meta/classes-recipe/sbom-cve-check.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)