From fd33a3736635653537ad52640ab6cc9cd5ea2173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hozza?= Date: Wed, 11 Sep 2024 13:32:29 +0200 Subject: [PATCH] Test/koji.sh: adjust for SBOM documents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adjust the test case to cope with the SPDX SBOM documents uploaded to the Koji. Also explicitly check that there is the expected number of SBOM documents uploaded as the image build output. Signed-off-by: Tomáš Hozza --- test/cases/koji.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/cases/koji.sh b/test/cases/koji.sh index 381fef40b..507fff293 100755 --- a/test/cases/koji.sh +++ b/test/cases/koji.sh @@ -185,7 +185,7 @@ function verify_buildinfo() { fi local outputs_manifests - outputs_manifests="$(koji -s "${KOJI_HUB_URL}" --noauth call --json listArchives "${buildid}" | jq -r 'map(select(.btype == "image" and .type_name == "json"))')" + outputs_manifests="$(koji -s "${KOJI_HUB_URL}" --noauth call --json listArchives "${buildid}" | jq -r 'map(select(.btype == "image" and .type_name == "json" and (.filename | contains(".manifest."))))')" local outputs_manifests_count outputs_manifests_count="$(echo "${outputs_manifests}" | jq 'length')" if [ "${outputs_manifests_count}" -ne "${outputs_images_count}" ]; then @@ -193,6 +193,16 @@ function verify_buildinfo() { exit 1 fi + local outputs_sboms + outputs_sboms="$(koji -s "${KOJI_HUB_URL}" --noauth call --json listArchives "${buildid}" | jq -r 'map(select(.btype == "image" and .type_name == "json" and (.filename | contains(".spdx."))))')" + local outputs_sboms_count + outputs_sboms_count="$(echo "${outputs_sboms}" | jq 'length')" + # there should be two SPDX files for each image, one for the image payload and one for the buildroot + if [ "${outputs_sboms_count}" -ne $((outputs_images_count * 2)) ]; then + echo "Mismatch between the number of image archives and SPDX SBOM files in the buildinfo" + exit 1 + fi + local outputs_logs outputs_logs="$(koji -s "${KOJI_HUB_URL}" --noauth call --json getBuildLogs "${buildid}" | jq -r 'map(select(.name != "cg_import.log"))')" local outputs_logs_count