File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff 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.
257257printf " %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.
260277KMOD_DIR=" ${ROOT_MOUNT} /lib/modules"
261278# First decompress the kernel modules, so they can be recompressed by EROFS.
You can’t perform that action at this time.
0 commit comments