-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
80 lines (61 loc) · 2.54 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
all:
@echo "Manual launch commands:"
@echo " make params # Display configuration options"
@echo " make options # Display the override options.env"
@echo " make running # Manually launch Running"
@echo " make hibernating # Manually launch Hibernating"
@echo " make cronjobs # Deploys the CronJobs"
@echo " make roles # Deploys the ClusterRole and ClusterRoleBinding"
@echo ""
@echo "Development commands"
@echo " make compile # Compile code"
@echo " make build # Build image"
@echo " make push # Build and push the image used by manual and cronjobs"
@echo " make tag-latest # Pushes the latest tag for the image"
@echo ""
@echo "Clean up:"
@echo " make clean # Deletes image from registry"
@echo " make clean-cronjobs # Deletes the CronJobs"
@echo " make clean-roles # Deletes the ClusterRole and ClusterRoleBinding"
checks:
ifeq (${REPO_URL},)
$(error "No REPO_URL environment variable")
endif
ifeq (${VERSION},)
$(error "No VERSION environment variable")
endif
options.env:
touch options.env
options:
@cat ./options.env
@echo ""
params:
oc process -f templates/cronjobs.yaml --parameters
clean: checks
docker image rm ${REPO_URL}/hibernation-curator:${VERSION}
running: options.env
oc process -f templates/running-job.yaml --param-file options.env --ignore-unknown-parameters=true | oc apply -f -
hibernating: options.env
oc process -f templates/hibernating-job.yaml --param-file options.env --ignore-unknown-parameters=true | oc apply -f -
cronjobs: options.env
oc process -f templates/cronjobs.yaml --param-file options.env --ignore-unknown-parameters=true | oc apply -f -
clean-cronjobs: options.env
oc process -f templates/cronjobs.yaml --param-file options.env --ignore-unknown-parameters=true | oc delete -f -
roles: options.env
oc process -f templates/roles.yaml --param-file options.env --ignore-unknown-parameters=true | oc apply -f -
clean-roles: options.env
oc process -f templates/roles.yaml --param-file options.env --ignore-unknown-parameters=true | oc delete -f -
compile:
go mod tidy
go mod vendor
go build -o action ./pkg
build: checks
docker build -f Dockerfile.prow . -t ${REPO_URL}/hibernation-curator:${VERSION}
push: checks build
docker push ${REPO_URL}/hibernation-curator:${VERSION}
tag-latest: push
docker tag ${REPO_URL}/hibernation-curator:${VERSION} ${REPO_URL}/hibernation-curator:latest
docker push ${REPO_URL}/hibernation-curator:latest
# Cluster pool scaling options
clusterpool-params:
oc process -f templates/scale-clusterpool-job.yaml --parameters