-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
40 lines (32 loc) · 1.21 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
# Copyright 2019 The OpenPitrix Authors. All rights reserved.
# Use of this source code is governed by a Apache license
# that can be found in the LICENSE file.
login-dockerhub:
echo "$(DOCKER_PASSWORD)" | docker login -u "$(DOCKER_USERNAME)" --password-stdin
build-image-%: ## build docker image
@if [ "$*" = "latest" ];then \
docker build -t openpitrix/watcher:latest .; \
elif [ "`echo "$*" | grep -E "^v[0-9]+\.[0-9]+\.[0-9]+"`" != "" ];then \
docker build -t openpitrix/watcher:$* .; \
fi
push-image-%: ## push docker image
@if [ "$*" = "latest" ];then \
docker push openpitrix/watcher:latest; \
elif [ "`echo "$*" | grep -E "^v[0-9]+\.[0-9]+\.[0-9]+"`" != "" ];then \
docker push openpitrix/watcher:$*; \
fi
build-push-image-%: ## build and push docker image
make build-image-$*
make login-dockerhub
make push-image-$*
.PHONY: test
test: ## Run all tests
make load-config-test
make update-test
@echo "test done"
load-config-test: ## Run test for LoadConf
cd ./test && go test -v -run ^TestLoadConf$ && cd ..
@echo "load-config-test done"
update-test: ## Run unit test for UpdateOpenPitrixEtcd
cd ./test && go test -v -run ^TestWatchOpenPitrixConfig$ && cd ..
@echo "update-openpitrix-etcd-test done"