Skip to content

Commit

Permalink
Make sbom exclusion reusable
Browse files Browse the repository at this point in the history
Signed-off-by: John Cowen <[email protected]>
  • Loading branch information
johncowen committed Jan 17, 2025
1 parent c3ac66c commit 1d81b99
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/config/src/mk/help.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ KUMAHQ_CONFIG := $(shell npm query .workspace | jq -r '.[] | select(.name == "@k

.PHONY: .help
.help: ## Display this help screen
@echo "The following targets can be used by running \`make <target>\`"; echo "---"
@echo "The following targets can be used by running \`make <target>\` in this directory:"; echo "---"
@# Display top-level targets since they are the ones most developers will need.
@grep -h -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort -k1 | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@# Now show hierarchical targets in separate sections.
Expand Down
21 changes: 13 additions & 8 deletions packages/config/src/mk/release.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,21 @@
#
# This reduces incorrect SBOM entries, decreasing cataloged dependencies
# from 872 to 157 at the time of this change.
.PHONY: .release/prune
.release/prune:
@if [ -z "$(KUMAHQ_CONFIG)" ]; then \
echo "Error: KUMAHQ_CONFIG is not set or empty."; \
.PHONY: .sbom/exclude
.sbom/exclude: EXCLUDE_PATH?=$(KUMAHQ_CONFIG)
.sbom/exclude:
@if [ -z "$(EXCLUDE_PATH)" ]; then \
echo "Error: EXCLUDE_PATH is not set or empty."; \
exit 1; \
fi
@if [ ! -d "$(KUMAHQ_CONFIG)" ]; then \
echo "Error: KUMAHQ_CONFIG does not exist or is not a directory: $(KUMAHQ_CONFIG)"; \
@if [ ! -d "$(EXCLUDE_PATH)" ]; then \
echo "Error: EXCLUDE_PATH does not exist or is not a directory: $(EXCLUDE_PATH)"; \
exit 1; \
fi
@echo '$(shell node -e "console.log(require('@kumahq/config').ci.depsToDevDeps('$(KUMAHQ_CONFIG)/package.json'))")' \
> $(KUMAHQ_CONFIG)/package.json
@echo '$(shell node -e "console.log(require('@kumahq/config').ci.depsToDevDeps('$(EXCLUDE_PATH)/package.json'))")' \
> $(EXCLUDE_PATH)/package.json

.PHONY: .release/prune
.release/prune:
@$(MAKE) .sbom/exclude EXCLUDE_PATH=$(KUMAHQ_CONFIG)
@npm install --package-lock-only

0 comments on commit 1d81b99

Please sign in to comment.