forked from redhat-developer/openshift-jenkins-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (68 loc) · 3.15 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
.DEFAULT_GOAL:=help
SHELL:=/bin/bash
NAMESPACE=jenkins-operator
##@ Application
install: ## Install all resources (CR/CRD's, RBAC and Operator)
@echo ....... Creating namespace .......
- kubectl create namespace ${NAMESPACE}
@echo ....... Applying CRDs .......
- kubectl apply -f deploy/crds/jenkins.dev_jenkins_crd.yaml -n ${NAMESPACE}
@echo ....... Applying Rules and Service Account .......
- kubectl apply -f deploy/role.yaml -n ${NAMESPACE}
- kubectl apply -f deploy/role_binding.yaml -n ${NAMESPACE}
- kubectl apply -f deploy/service_account.yaml -n ${NAMESPACE}
@echo ....... Applying Operator .......
- kubectl apply -f deploy/operator.yaml -n ${NAMESPACE}
@echo ....... Creating the CRs .......
- kubectl apply -f deploy/crds/jenkins.dev_v1alpha1_jenkins_cr.yaml -n ${NAMESPACE}
uninstall: ## Uninstall all that all performed in the $ make install
@echo ....... Uninstalling .......
@echo ....... Deleting CRDs.......
- kubectl delete -f deploy/crds/jenkins.dev_jenkins_crd.yaml -n ${NAMESPACE}
@echo ....... Deleting Rules and Service Account .......
- kubectl delete -f deploy/role.yaml -n ${NAMESPACE}
- kubectl delete -f deploy/role_binding.yaml -n ${NAMESPACE}
- kubectl delete -f deploy/service_account.yaml -n ${NAMESPACE}
@echo ....... Deleting Operator .......
- kubectl delete -f deploy/operator.yaml -n ${NAMESPACE}
@echo ....... Deleting namespace ${NAMESPACE}.......
- kubectl delete namespace ${NAMESPACE}
##@ Development
code-vet: ## Run go vet for this project. More info: https://golang.org/cmd/vet/
@echo go vet
go vet $$(go list ./... )
code-fmt: ## Run go fmt for this project
@echo go fmt
go fmt $$(go list ./... )
code-dev: ## Run the default dev commands which are the go fmt and vet then execute the $ make code-gen
@echo Running the common required commands for developments purposes
- make code-fmt
- make code-vet
- make code-gen
code-gen: ## Run the operator-sdk commands to generated code (k8s and openapi)
@echo Updating the deep copy files with the changes in the API
operator-sdk generate k8s
@echo Updating the CRD files with the OpenAPI validations
operator-sdk generate openapi
##@ Tests
test-e2e: ## Run integration e2e tests with different options.
@echo ... Running the same e2e tests with different args ...
@echo ... Running locally ...
- kubectl create namespace ${NAMESPACE} || true
- operator-sdk test local ./test/e2e --up-local --namespace=${NAMESPACE}
@echo ... Running NOT in parallel ...
- operator-sdk test local ./test/e2e --go-test-flags "-v -parallel=1"
@echo ... Running in parallel ...
- operator-sdk test local ./test/e2e --go-test-flags "-v -parallel=2"
@echo ... Running without options/args ...
- operator-sdk test local ./test/e2e
@echo ... Running with the --debug param ...
- operator-sdk test local ./test/e2e --debug
@echo ... Running with the --verbose param ...
- operator-sdk test local ./test/e2e --verbose
.PHONY: help
help: ## Display this help
@echo -e "Usage:\n make \033[36m<target>\033[0m"
@awk 'BEGIN {FS = ":.*##"}; \
/^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } \
/^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)