This repository has been archived by the owner on Jan 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 47
/
Makefile
executable file
·89 lines (70 loc) · 1.83 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Following gets combined into: REGISTRY/REGISTRY_PATH/IMAGE:VERSION
REGISTRY?=csemcr.azurecr.io
IMAGE?=test/k8s/metrics/adapter
VERSION?=latest
ifneq ("$(REGISTRY)", "")
FULL_IMAGE=$(REGISTRY)/$(IMAGE)
else
FULL_IMAGE=$(IMAGE)
endif
OUT_DIR?=./_output
SEMVER=""
PUSH_LATEST=true
BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
.PHONY: all build-local build vendor test version push \
verify-deploy gen-deploy dev save tag-ci
all: build
build-local: test
CGO_ENABLED=0 go build -a -tags netgo -o $(OUT_DIR)/adapter github.com/Azure/azure-k8s-metrics-adapter
build: vendor verify-deploy verify-apis
docker build -t $(FULL_IMAGE):$(VERSION) .
vendor:
go mod vendor
test: vendor
hack/run-tests.sh
version: build
ifeq ("$(SEMVER)", "")
@echo "Please set sem version bump: can be 'major', 'minor', or 'patch'"
exit
endif
ifeq ("$(BRANCH)", "master")
@echo "versioning on master"
gitsem $(SEMVER)
else
@echo "must be on clean master branch"
endif
push:
ifdef DOCKER_PASS
# non interactive login
@echo $(DOCKER_PASS) | docker login -u $(DOCKER_USER) --password-stdin $(REGISTRY)
else
# interactive login (needed for WSL)
docker login -u $(DOCKER_USER) $(REGISTRY)
endif
docker push $(FULL_IMAGE):$(VERSION)
ifeq ("$(PUSH_LATEST)", "true")
@echo "pushing to latest"
docker tag $(FULL_IMAGE):$(VERSION) $(FULL_IMAGE):latest
docker push $(FULL_IMAGE):latest
endif
# dev setup
dev:
skaffold dev
teste2e:
hack/run-e2e.sh
# CI specific commands used during CI build
save:
docker save -o app.tar $(FULL_IMAGE):$(VERSION)
tag-ci:
docker tag $(FULL_IMAGE):$(CIRCLE_WORKFLOW_ID) $(FULL_IMAGE):$(VERSION)
# Code gen helpers
gen-apis: vendor
hack/update-codegen.sh
verify-apis: vendor
hack/verify-codegen.sh
# Helm deploy generator helpers
verify-deploy:
hack/verify-deploy.sh
gen-deploy:
hack/gen-deploy.sh
gen-all: gen-apis gen-deploy