Skip to content

Commit 9bec851

Browse files
committed
Add run_audit_example and run_restrict_example targets
1 parent 784dd68 commit 9bec851

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

Makefile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,43 @@ test_audit_mode: ## Run audit mode tests
6969
.PHONY: test_unit
7070
test_unit: ## Run unit tests
7171
@node --test setup/lib/rules.test.mjs
72+
73+
.PHONY: test_audit_example
74+
run_audit_example: ## Run audit mode example tests
75+
@echo "Running audit mode example tests..."
76+
@$(MAKE) run_audit_mode
77+
@mkdir -p /tmp/build-context
78+
@printf '%s\n' \
79+
"FROM node:24-alpine" \
80+
"WORKDIR /app" \
81+
"RUN npm init -y && npm install express" \
82+
> /tmp/build-context/Dockerfile
83+
docker buildx build --no-cache \
84+
--builder buildcage \
85+
--platform linux/arm64 \
86+
--progress=plain -f /tmp/build-context/Dockerfile /tmp/build-context \
87+
--load -t buildcage-test
88+
@node report/main.mjs ./compose.yml
89+
@$(MAKE) clean
90+
rm -fr /tmp/build-context
91+
92+
.PHONY: run_restrict_example
93+
run_restrict_example: ## Run restrict mode example tests
94+
@echo "Running restrict mode example tests..."
95+
@ALLOWED_HTTPS_RULES="registry.npmjs.org:443" \
96+
$(MAKE) run_restrict_mode
97+
@mkdir -p /tmp/build-context
98+
@printf '%s\n' \
99+
"FROM node:24-alpine" \
100+
"WORKDIR /app" \
101+
"RUN npm init -y && npm install express" \
102+
"RUN wget -q -O /dev/null --timeout=5 https://example.com/ || true" \
103+
> /tmp/build-context/Dockerfile
104+
docker buildx build --no-cache \
105+
--builder buildcage \
106+
--platform linux/arm64 \
107+
--progress=plain -f /tmp/build-context/Dockerfile /tmp/build-context \
108+
--load -t buildcage-test
109+
@node report/main.mjs ./compose.yml || true
110+
@$(MAKE) clean
111+
rm -fr /tmp/build-context

0 commit comments

Comments
 (0)