forked from secureCodeBox/secureCodeBox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hooks.mk
60 lines (47 loc) · 1.82 KB
/
hooks.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
#!/usr/bin/make -f
#
# SPDX-FileCopyrightText: the secureCodeBox authors
#
# SPDX-License-Identifier: Apache-2.0
#
#
# This include is a base for all hooks make files.
module = hook
prefix = hook
name = ${hook}
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 = $(hook-prefix)
.PHONY: docker-build
docker-build: | common-docker-build
.PHONY: docker-export
docker-export: | common-docker-export
.PHONY: kind-import
kind-import: | common-kind-import
.PHONY: unit-tests
unit-tests:
@$(MAKE) -s unit-test-js
.PHONY: helm-unit-tests
helm-unit-tests:
echo "Running helm unit tests for $(name)"; \
helm unittest . \
.PHONY: deploy
deploy: ## 💾 Deploy this module via HelmChart into namespace "integration-tests"
@echo ".: 💾 Deploying '$(name)' $(hook-prefix) HelmChart with the docker tag '$(IMG_TAG)' into kind namespace 'integration-tests'."
helm -n integration-tests upgrade --install $(name) . --wait \
--set="hook.image.repository=docker.io/$(IMG_NS)/$(hook-prefix)-$(name)" \
--set="hook.image.tag=$(IMG_TAG)"
.PHONY: integration-tests
integration-tests: ## 🩺 Start integration test for this module in the namespace "integration-tests"
@echo ".: 🩺 Starting integration test in kind namespace 'integration-tests'."
@if [ -d "$(hook-prefix)/integration-tests" ]; then \
kubectl -n integration-tests delete scans --all; \
npm ci --prefix $(TESTS_HELPERS_DIR); \
cd $(hook-prefix)/integration-tests && npm ci && npm run test:integration \
else \
echo ".: 🚫 Integration tests folder for $(name) does not exist, skipped."; \
fi