-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (45 loc) · 1.53 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
VERSION ?= $(shell cat VERSION)
DOCKER_CMD ?= $(shell which docker)
ifeq ($(DOCKER_CMD),)
DOCKER_CMD = $(shell which podman)
endif
.PHONY: build
build: inspect \
bin/konfirm-http \
bin/konfirm-storage
.PHONY: test
export PATH := $(shell pwd)/bin:$(PATH)
test: bin/konfirm-storage bin/konfirm-http
go test ./cmd/... ./internal/... ./pkg/... -test.v --ginkgo.github-output
.PHONY: clean
clean:
[ ! -d .cache ] || rm -rf .cache
[ ! -d bin ] || rm -rf bin
[ ! -f cover.out ] || rm cover.out
[ ! -f inspect ] || rm inspect
.PHONY: image
IMAGE_REPO ?= ghcr.io/raft-tech/konfirm/inspections
IMAGE_TAG ?= $(VERSION)
image:
$(DOCKER_CMD) buildx build -t $(IMAGE_REPO):$(IMAGE_TAG) .
CACHE ?= $(shell pwd)/.cache
$(CACHE):
mkdir -p $(CACHE)
.PHONY: kind-load
KIND_CLUSTER ?= konfirm
kind-load: image $(CACHE)
$(DOCKER_CMD) image save $(IMAGE_REPO):$(IMAGE_TAG) > $(CACHE)/inspections.tar | kind load image-archive --name $(KIND_CLUSTER) $(CACHE)/inspections.tar
MONITORING_GATEWAY ?= gateway-prometheus-pushgateway.monitoring:9091
INSTALL_NAMESPACE ?= konfirm-inspections
install:
helm upgrade --install --create-namespace -n $(INSTALL_NAMESPACE) inspect ./charts/inspect \
--set monitoring.gateway=$(MONITORING_GATEWAY),inspections.storage.when.cron='* * * * *'
.PHONY: inspect
inspect:
go build -o inspect .
.PHONY: bin/konfirm-http
bin/konfirm-http:
go test -tags inspection -c -o bin/konfirm-http ./inspections/http
.PHONY: bin/konfirm-storage
bin/konfirm-storage:
go test -tags inspection -c -o bin/konfirm-storage ./inspections/storage