-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
54 lines (46 loc) · 1.23 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
.DEFAULT_GOAL := all
CMD_DOCKER := $(shell command -v docker 2> /dev/null)
CMD_KUBECTL := $(shell command -v kubectl 2> /dev/null)
CMD_HELM := $(shell command -v helm 2> /dev/null)
CMD_GO := $(shell command -v go 2> /dev/null)
CMD_DEP := $(shell command -v dep 2> /dev/null)
CMD_OPERATOR_SDK := $(shell command -v operator-sdk 2> /dev/null)
DOCKER_USERNAME := edgelevel
DOCKER_IMAGE := $(DOCKER_USERNAME)/lastpass-operator
.PHONY: requirements
requirements:
ifndef CMD_DOCKER
$(error "docker" not found)
endif
# ifndef CMD_KUBECTL
# $(error "kubectl" not found)
# endif
# ifndef CMD_HELM
# $(error "helm" not found)
# endif
ifndef CMD_GO
$(error "go" not found)
endif
ifndef CMD_DEP
$(error "dep" not found)
endif
ifndef CMD_OPERATOR_SDK
$(error "operator-sdk" not found)
endif
.PHONY: test
test:
dep ensure
go test -v ./...
.PHONY: all
all: requirements test
.PHONY: docker-build
docker-build: all
operator-sdk build $(DOCKER_IMAGE):${tag}
.PHONY: docker-login
docker-login:
echo ${docker-password} | docker login -u $(DOCKER_USERNAME) --password-stdin
.PHONY: docker-push
docker-push: docker-build docker-login
docker tag $(DOCKER_IMAGE):${tag} $(DOCKER_IMAGE):latest
docker push $(DOCKER_IMAGE):${tag}
docker push $(DOCKER_IMAGE):latest