-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
33 lines (25 loc) · 848 Bytes
/
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
SHELL = /bin/bash -O globstar
CC = go
PROGRAM = validator
BUILDDIR = build
CONTEXT = $(shell kubectl config current-context)
ifneq (,$(findstring development,$(CONTEXT)))
CLUSTER=development
else ifneq (,$(findstring beta,$(CONTEXT)))
CLUSTER=beta
else ifneq (,$(findstring production,$(CONTEXT)))
CLUSTER=production
endif
.PHONY: build clean cleanBuild validate
build: $(PROGRAM)
$(PROGRAM):
$(CC) build
clean:
rm -f $(PROGRAM)
cleanBuild:
rm -rf $(BUILDDIR)
validate: cleanBuild
for s in $$(kubectl get deploy -ocustom-columns=NAME:.metadata.name --no-headers | sort); do \
d=$$(grep "name: $$s" -l /home/btoll/projects/veriforce/devops/gitops-test/**/*-deployment.yaml); \
./$(PROGRAM) --file <(kubectl kustomize $$(echo "$$d" | sed 's/base.*/overlays\/$(CLUSTER)/' 2> /dev/null) 2> /dev/null | yq -o json); \
done