forked from secureCodeBox/secureCodeBox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scanners.mk
99 lines (83 loc) · 3.41 KB
/
scanners.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/make -f
#
# SPDX-FileCopyrightText: the secureCodeBox authors
#
# SPDX-License-Identifier: Apache-2.0
#
#
# This include is a base for all scanners make files.
name = ${scanner}
include ../../test-base.mk
include ../../env-paths.mk
# Telling the env-paths file where the root project dir is. This is done to allow the generation of the paths of the
# different project folders relative to where the makefile is being run from. So BIN_DIR= $(PROJECT_DIR)/bin will be
# BIN_DIR=../../bin
PROJECT_DIR=../..
module = $(scanner-prefix)
# IMPORTANT: The body of conditionals MUST not be indented! Indentation result in
# errors on macOS/FreeBSD because the line wil be interpreted as command which must
# inside a recipe (target). (see https://github.com/secureCodeBox/secureCodeBox/issues/1353)
ifeq ($(custom_scanner),)
docker-build: | docker-build-parser
docker-export: | docker-export-parser
kind-import: | kind-import-parser
deploy: deploy-without-scanner
else
docker-build: | docker-build-parser docker-build-scanner
docker-export: | docker-export-parser docker-export-scanner
kind-import: | kind-import-parser kind-import-scanner
deploy: deploy-with-scanner
endif
.PHONY: unit-tests
unit-tests:
@$(MAKE) -s unit-test-js module=$(parser-prefix)
.PHONY: helm-unit-tests
helm-unit-tests:
echo "Running helm unit tests for $(name)"; \
helm unittest . \
.PHONY: install-deps
install-deps:
@$(MAKE) -s install-deps-js module=$(parser-prefix)
.PHONY: docker-build-parser
docker-build-parser:
@$(MAKE) -s common-docker-build module=$(parser-prefix)
.PHONY: docker-export-parser
docker-export-parser:
@$(MAKE) -s common-docker-export module=$(parser-prefix)
.PHONY: kind-import-parser
kind-import-parser:
@$(MAKE) -s common-kind-import module=$(parser-prefix)
.PHONY: docker-build-scanner
docker-build-scanner:
@$(MAKE) -s common-docker-build
.PHONY: docker-export-scanner
docker-export-scanner:
@$(MAKE) -s common-docker-export
.PHONY: kind-import-scanner
kind-import-scanner:
@$(MAKE) -s common-kind-import
.PHONY: deploy-without-scanner
deploy-without-scanner:
@echo ".: 💾 Deploying '$(name)' $(scanner-prefix) HelmChart with the docker tag '$(IMG_TAG)' into kind namespace 'integration-tests'."
helm -n integration-tests upgrade --install $(name) ./ --wait \
--set="parser.image.repository=docker.io/$(IMG_NS)/$(parser-prefix)-$(name)" \
--set="parser.image.tag=$(IMG_TAG)" \
--set="parser.env[0].name=CRASH_ON_FAILED_VALIDATION" \
--set-string="parser.env[0].value=true" \
--set="scanner.backoffLimit=1"
.PHONY: deploy-with-scanner
deploy-with-scanner:
@echo ".: 💾 Deploying '$(name)' $(scanner-prefix) HelmChart with the docker tag '$(IMG_TAG)' into kind namespace 'integration-tests'."
helm -n integration-tests upgrade --install $(name) ./ --wait \
--set="parser.image.repository=docker.io/$(IMG_NS)/$(parser-prefix)-$(name)" \
--set="parser.image.tag=$(IMG_TAG)" \
--set="parser.env[0].name=CRASH_ON_FAILED_VALIDATION" \
--set-string="parser.env[0].value=true" \
--set="scanner.image.repository=docker.io/$(IMG_NS)/$(scanner-prefix)-$(name)" \
--set="scanner.image.tag=$(IMG_TAG)" \
--set="scanner.backoffLimit=1"
.PHONY: integration-tests
integration-tests:
@echo ".: 🩺 Starting integration test in kind namespace 'integration-tests'."
kubectl -n integration-tests delete scans --all
cd $(SCANNERS_DIR) && npm ci && cd $(scanner)/integration-tests && npm run test:integration -- $(scanner)/integration-tests