Skip to content

Commit 43c0922

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

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

twoliter/embedded/.rpm2img.swp

36 KB
Binary file not shown.

twoliter/embedded/rpm2img

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,23 @@ 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 SBOMs into a single json file
260+
KIT_SBOMS_DIR="${ROOT_MOUNT}/usr/share/sboms"
261+
if [ -d "${KIT_SBOMS_DIR}" ]; then
262+
IMAGE_SBOM_DIR="${ROOT_MOUNT}/usr/share/bottlerocket"
263+
mkdir -p "${IMAGE_SBOM_DIR}"
264+
for format in "spdx" "cyclonedx"; do
265+
image_sbom="${format}-sbom.json"
266+
image_sbom_path="${IMAGE_SBOM_DIR}/${image_sbom}"
267+
find "${KIT_SBOMS_DIR}" -name "*-${format}.json" -type f -exec sbomtool merge --output "${image_sbom_path}" {} \+
268+
269+
# Write the inventory to a file in the local build output directory
270+
cp "${image_sbom_path}" "${OUTPUT_DIR}/${image_sbom}"
271+
done
272+
# Clean up old SBOM packages
273+
rm -rf "${KIT_SBOMS_DIR}"
274+
fi
275+
259276
# Regenerate module dependencies, if possible.
260277
KMOD_DIR="${ROOT_MOUNT}/lib/modules"
261278
# First decompress the kernel modules, so they can be recompressed by EROFS.

0 commit comments

Comments
 (0)