-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.common
More file actions
36 lines (27 loc) · 1.32 KB
/
Copy pathMakefile.common
File metadata and controls
36 lines (27 loc) · 1.32 KB
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
SHELL=/bin/bash -o pipefail
MANIFESTS_DIR=manifests
TLD=$(shell git rev-parse --show-toplevel)
SCHEMAS_DIR=$(TLD)/tmp/schemas
KUBESCAPE_THRESHOLD=10
.PHONY: beautify
beautify: ## Make yaml files readable
for i in $(shell find $(MANIFESTS_DIR)/ -name '*.yaml'); do yq --prettyPrint --no-colors --inplace "$$i"; done
.PHONY: version-update
version-update: ## Upgrade component version and image
$(TLD)/hack/version-update.sh .
$(SCHEMAS_DIR):
$(TLD)/hack/generate-schemas.sh
.PHONY: validate
validate: $(MANIFESTS_DIR) $(SCHEMAS_DIR)
kubeconform \
-schema-location 'https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/{{ .NormalizedKubernetesVersion }}-standalone{{ .StrictSuffix }}/{{ .ResourceKind }}.json' \
-schema-location '$(SCHEMAS_DIR)/{{ .ResourceKind }}.json' \
-skip CustomResourceDefinition,SealedSecret,Kustomization,Provider,Alert,Receiver \
-summary \
$(MANIFESTS_DIR)
.PHONY: sec-scan
sec-scan: ## Security scanning of manifests
kubescape scan -s framework -t $(KUBESCAPE_THRESHOLD) nsa $(shell find $(MANIFESTS_DIR)/ -name '*.yaml') --exceptions 'kubescape-exceptions.json'
.PHONY: help
help: ## Displays help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[a-z0-9A-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)