Skip to content

Commit e964ba4

Browse files
committed
chore: merge SBOM packages and remove old SBOM's
1 parent abdee51 commit e964ba4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

twoliter/embedded/rpm2img

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,16 @@ printf "%s\n" "${INVENTORY_DATA}" >"${ROOT_MOUNT}/usr/share/bottlerocket/applica
256256
# can access the inventory without needed to dig into the generated image.
257257
printf "%s\n" "${INVENTORY_DATA}" >"${OUTPUT_DIR}/application-inventory.json"
258258

259+
# Merge SBOM's into a single json file
260+
KIT_SBOMS_DIR="${ROOT_MOUNT}/usr/share/sboms"
261+
IMAGE_SBOM_DIR="${ROOT_MOUNT}/usr/share/bottlerocket/sbom"
262+
mkdir -p "${IMAGE_SBOM_DIR}"
263+
for format in "spdx" "cyclonedx"; do
264+
find "${KIT_SBOMS_DIR}" -name "*-${format}.json" -type f -exec sbomtool merge --output "${IMAGE_SBOM_DIR}/image-${format}.json" {} \+
265+
done
266+
# Clean up old SBOM packages
267+
rm -rf "${KIT_SBOMS_DIR}"
268+
259269
# Regenerate module dependencies, if possible.
260270
KMOD_DIR="${ROOT_MOUNT}/lib/modules"
261271
# First decompress the kernel modules, so they can be recompressed by EROFS.

0 commit comments

Comments
 (0)