Skip to content

Commit

Permalink
Add generating SBOM task
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 committed Dec 15, 2023
1 parent e8f3cd7 commit 60d382d
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ WINDOWS_IMAGES := \
v1.16/windows-ltsc2019:v1.16.3-windows-ltsc2019-1.0,v1.16-windows-ltsc2019-1 \
v1.16/windows-ltsc2022:v1.16.3-windows-ltsc2022-1.0,v1.16-windows-ltsc2022-1

ALL_IMAGES := $(X86_IMAGES) $(ARM_IMAGES) $(ARM64_IMAGES) $(WINDOWS_IMAGES)
LINUX_IMAGES := $(X86_IMAGES) $(ARM_IMAGES) $(ARM64_IMAGES)
ALL_IMAGES := $(LINUX_IMAGES) $(WINDOWS_IMAGES)

# Default is first image from ALL_IMAGES list.
DOCKERFILE ?= $(word 1,$(subst :, ,$(word 1,$(ALL_IMAGES))))
Expand Down Expand Up @@ -110,6 +111,23 @@ release-all:
TAGS=$(word 2,$(subst :, ,$(img))) ; \
))

sbom:
(set -e ; $(foreach tag, $(parsed-tags), \
rm -rf sbom \
rm -rf spdx-json \
mkdir -p $(DOCKERFILE)/licenses \
docker sbom $(IMAGE_NAME):$(tag) --output $(DOCKERFILE)/licenses/fluentd-${VERSION}.spdx.json --format spdx-json; \
docker sbom $(IMAGE_NAME):$(tag) --output $(DOCKERFILE)/licenses/fluentd-${VERSION}.cyclonedx.json --format cyclonedx-json; \
))

sbom-all:
(set -e ; $(foreach img,$(LINUX_IMAGES), \
make sbom \
DOCKERFILE=$(word 1,$(subst :, ,$(img))) \
VERSION=$(word 1,$(subst $(comma), ,\
$(word 2,$(subst :, ,$(img))))) \
TAGS=$(word 2,$(subst :, ,$(img))) ; \
))


# Generate Docker image sources.
Expand Down

0 comments on commit 60d382d

Please sign in to comment.