forked from kubewarden/kubewarden-end-to-end-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (46 loc) · 1.76 KB
/
Makefile
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
.DEFAULT_GOAL := all
MKFILE_DIR ?= $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
TESTS_DIR ?= $(MKFILE_DIR)tests
RESOURCES_DIR ?= $(MKFILE_DIR)resources
NAMESPACE ?= kubewarden
CLUSTER_CONTEXT ?= $(shell kubectl config current-context)
# ==================================================================================================
# Optional arguments for scripts
# cluster_k3d.sh:
# K3S=[1.30] - short|long version
# CLUSTER_NAME=[k3d-default]
# helmer.sh:
# VERSION=[next|prev|v1.17.0-rc2|local] (app version)
# REPO_NAME=[kubewarden]
# CHARTS_LOCATION=[./dirname|reponame]
# LATEST=[1]
# CRDS_ARGS, DEFAULTS_ARGS, CONTROLLER_ARGS
# ==================================================================================================
# Targets
.PHONY: clean cluster install upgrade uninstall tests all
# Generate target for every test file
TESTFILES := $(notdir $(wildcard tests/*.bats))
$(TESTFILES):
@RESOURCES_DIR=$(RESOURCES_DIR) \
NAMESPACE=$(NAMESPACE) \
CLUSTER_CONTEXT=$(CLUSTER_CONTEXT) \
bats -T --print-output-on-failure $(TESTS_DIR)/$@
# Target all non-destructive tests
tests: $(filter-out upgrade.bats audit-scanner-installation.bats, $(TESTFILES))
cluster:
./scripts/cluster_k3d.sh create
install: check
./scripts/helmer.sh install
upgrade:
./scripts/helmer.sh upgrade
$(MAKE) upgrade.bats
uninstall:
./scripts/helmer.sh uninstall
clean:
./scripts/cluster_k3d.sh delete
all: clean cluster install tests
check:
@yq --version | grep mikefarah > /dev/null || { echo "yq is not the correct, needs mikefarah/yq!"; exit 1; }
@jq --version > /dev/null || { echo "jq is not installed!"; exit 1; }
@k3d --version > /dev/null || { echo "k3d is not installed!"; exit 1; }
@bats --version > /dev/null || { echo "bats is not installed!"; exit 1; }