-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
76 lines (60 loc) · 1.57 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
GO111MODULE = on
export GO111MODULE
GOFLAGS ?= -mod=vendor
export GOFLAGS
GOPROXY ?=
export GOPROXY
REG ?= registry.okd4.teh-1.snappcloud.io
IMG ?= $(REG)/public-reg/cluster-machine-approver:latest
NO_DOCKER ?= 0
ifeq ($(shell command -v podman > /dev/null 2>&1 ; echo $$? ), 0)
ENGINE=podman
else ifeq ($(shell command -v docker > /dev/null 2>&1 ; echo $$? ), 0)
ENGINE=docker
else
NO_DOCKER=1
endif
USE_DOCKER ?= 0
ifeq ($(USE_DOCKER), 1)
ENGINE=docker
endif
ifeq ($(NO_DOCKER), 1)
DOCKER_CMD =
IMAGE_BUILD_CMD = imagebuilder
else
DOCKER_CMD := $(ENGINE) run --env GO111MODULE=$(GO111MODULE) --env GOFLAGS=$(GOFLAGS) --rm -v "$(PWD)":/go/src/github.com/openshift/cluster-machine-approver:Z -w /go/src/github.com/openshift/cluster-machine-approver openshift/origin-release:golang-1.15
IMAGE_BUILD_CMD = sudo $(ENGINE) build
endif
all build:
$(DOCKER_CMD) go build -o machine-approver .
.PHONY: all build
test:
$(DOCKER_CMD) hack/ci-test.sh
.PHONY: test
unit:
$(DOCKER_CMD) go test -v ./...
.PHONY: unit
.PHONY: goimports
goimports: ## Go fmt your code
$(DOCKER_CMD) hack/goimports.sh .
images:
ifeq ($(NO_DOCKER), 1)
./hack/imagebuilder.sh
endif
$(IMAGE_BUILD_CMD) -f Dockerfile -t $(IMG) .
.PHONY: images
clean:
$(DOCKER_CMD) $(RM) ./machine-approver
.PHONY: clean
test-e2e: ## Run e2e tests
hack/e2e.sh
.PHONY: test-e2e
.PHONY: vendor
vendor:
$(DOCKER_CMD) hack/go-mod.sh
image-push: image-login
sudo $(ENGINE) push $(IMG)
image-login:
sudo $(ENGINE) login ${REG} -u ${REG_USER} -p ${REG_PASSWORD}
redeploy: images image-push
oc delete po --all -n machine-approver