forked from stolostron/hibernate-cronjob
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
96 lines (76 loc) · 2.77 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
90
91
92
93
94
95
96
NAMESPACE := open-cluster-management
all:
@echo "Development commands with Python:"
@echo " make build-py # Build Python image ONLY"
@echo " make push-py # Build and push the Pyhton image used by manual and cronjobs"
@echo " make tag-py-latest # Pushes the latest tag for the Python based image"
@echo ""
@echo "Manual launch commands with Python:"
@echo " make running-py # Manually launch Running"
@echo " make hibernate-py # Manually launch Hibernating"
@echo " make setup-py # Deploys the Python cronjobs"
@echo ""
@echo "Development commands with Go"
@echo " make compile-go # Compile Go code ONLY"
@echo " make build-go # Build Go image ONLY"
@echo " make push-go # Build and push the Go image used by manual and cronjobs"
@echo " make tag-go-latest # Pushes the latest tag for the Go based image"
@echo ""
@echo "Manual launch commands with Go:"
@echo " make running-go # Manually launch Running"
@echo " make hibernate-go # Manually launch Hibernating"
@echo " make setup-go # Deploys the Go cronjobs"
@echo ""
@echo "Clean up:"
@echo " make clean-py"
@echo " make clean-go"
checks:
ifeq (${REPO_URL},)
err: ; "No REPO_URL environment variable"
endif
ifeq (${VERSION},)
err: ; "Specify a VERSION environment variables"
endif
setup:
@echo "You must choose setup-py or setup-go"
build-py: checks
cp Dockerfile_PYTHON Dockerfile
docker build . -t ${REPO_URL}/hibernation-curator:${VERSION}
rm Dockerfile
push-py: checks build-py
docker push ${REPO_URL}/hibernation-curator:${VERSION}
tag-py-latest: push-py
docker tag ${REPO_URL}/hibernation-curator:${VERSION} ${REPO_URL}/hibernation-curator:latest
docker push ${REPO_URL}/hibernation-curator:latest
clean-py:
oc delete -k deploy-py
docker image rm ${REPO_URL}/hibernation-curator:${VERSION}
clean-go:
oc delete -k deploy-py
docker image rm ${REPO_URL}/hibernation-curator-go:${VERSION}
running-py:
oc -n ${NAMESPACE} create -f deploy-py/running-job.yaml
hibernate-py:
oc -n ${NAMESPACE} create -f deploy-py/hibernating-job.yaml
setup-py:
oc -n ${NAMESPACE} apply -k deploy-py/
# Go related routines
running-go:
oc -n ${NAMESPACE} create -f deploy-go/running-job.yaml
hibernate-go:
oc -n ${NAMESPACE} create -f deploy-go/hibernating-job.yaml
setup-go:
oc -n ${NAMESPACE} apply -k deploy-go/
compile-go:
go mod tidy
go mod vendor
go build -o action ./pkg
build-go: checks compile-go
cp Dockerfile_GO Dockerfile
docker build . -t ${REPO_URL}/hibernation-curator-go:${VERSION}
rm Dockerfile
push-go: checks build-go
docker push ${REPO_URL}/hibernation-curator-go:${VERSION}
tag-go-latest: push-go
docker tag ${REPO_URL}/hibernation-curator-go:${VERSION} ${REPO_URL}/hibernation-curator-go:latest
docker push ${REPO_URL}/hibernation-curator-go:latest