forked from opendevstack/ods-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
173 lines (136 loc) · 5.39 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
SHELL = /bin/bash
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
NAMESPACE=ods
NEXUS_URL=
SONARQUBE_URL=
# REPOSITORIES
## Prepare local repos (fetch changes from Bitbucket).
prepare-repos:
cd ods-setup && ./repos.sh --confirm
.PHONY: prepare-repos
## Sync repos (fetch changes from GitHub, and synchronize with Bitbucket).
sync-repos:
cd ods-setup && ./repos.sh --sync --confirm
.PHONY: sync-repos
# CONFIG
## Update local sample config sample and run check against local actual config.
prepare-config:
cd ods-setup && ./config.sh
.PHONY: prepare-config
# ODS SETUP
## Setup central "ods" project.
install-ods-project:
cd ods-setup && ./setup-ods-project.sh --namespace ${NAMESPACE} --reveal-secrets
# JENKINS
## Install or update Jenkins resources.
install-jenkins: apply-jenkins-build start-jenkins-build apply-jenkins-deploy
.PHONY: install-jenkins
## Update OpenShift resources related to Jenkins images.
apply-jenkins-build:
cd jenkins/ocp-config/build && tailor apply --namespace ${NAMESPACE}
.PHONY: apply-jenkins-build
## Install a jenkins instance in the ods namespace (needed by the provisioning app)
apply-jenkins-deploy:
cd jenkins/ocp-config/deploy && tailor apply --namespace ${NAMESPACE} --selector template=ods-jenkins-template
.PHONY: apply-jenkins-deploy
## Start build of all Jenkins BuildConfig resources.
start-jenkins-build: start-jenkins-build-master start-jenkins-build-slave-base start-jenkins-build-webhook-proxy
.PHONY: jenkins-build
## Start build of BuildConfig "jenkins-master".
start-jenkins-build-master:
ocp-scripts/start-and-follow-build.sh --namespace ${NAMESPACE} --build-config jenkins-master
.PHONY: start-jenkins-build-master
## Start build of BuildConfig "jenkins-slave-base".
start-jenkins-build-slave-base:
ocp-scripts/start-and-follow-build.sh --namespace ${NAMESPACE} --build-config jenkins-slave-base
.PHONY: start-jenkins-build-slave-base
## Start build of BuildConfig "jenkins-webhook-proxy".
start-jenkins-build-webhook-proxy:
ocp-scripts/start-and-follow-build.sh --namespace ${NAMESPACE} --build-config jenkins-webhook-proxy
.PHONY: start-jenkins-build-webhook-proxy
# PROVISIONING APP
## Install the provision app.
install-provisioning-app: apply-provisioning-app-deploy
.PHONY: install-provisioning-app
## Update OpenShift resources related to the Provisioning App service.
apply-provisioning-app-deploy:
cd ods-provisioning-app/ocp-config && tailor apply --namespace ${NAMESPACE}
.PHONY: apply-provisioning-app-deploy
# DOCUMENT GENERATION SERVICE
## Install the documentation generation service.
install-doc-gen: apply-doc-gen-build
.PHONY: install-doc-gen
## Update OpenShift resources related to the Document Generation image.
apply-doc-gen-build:
cd ods-doc-gen-svc/ocp-config && tailor apply --namespace ${NAMESPACE}
.PHONY: apply-doc-gen-build
# SONARQUBE
## Install or update SonarQube.
install-sonarqube: apply-sonarqube-build start-sonarqube-build apply-sonarqube-deploy configure-sonarqube
.PHONY: install-sonarqube
## Update OpenShift resources related to the SonarQube image.
apply-sonarqube-build:
cd sonarqube/ocp-config && tailor apply --namespace ${NAMESPACE} bc,is
.PHONY: apply-sonarqube-build
## Start build of BuildConfig "sonarqube".
start-sonarqube-build:
ocp-scripts/start-and-follow-build.sh --namespace ${NAMESPACE} --build-config sonarqube
.PHONY: start-sonarqube-build
## Update OpenShift resources related to the SonarQube service.
apply-sonarqube-deploy:
cd sonarqube/ocp-config && tailor apply --namespace ${NAMESPACE} --exclude bc,is
SONARQUBE_URL=`oc -n ${NAMESPACE} get route sonarqube -ojsonpath={.spec.host}`
echo "Visit ${SONARQUBE_URL}/setup to see if any update actions need to be taken."
.PHONY: apply-sonarqube-deploy
## Configure SonarQube service.
configure-sonarqube:
SONARQUBE_URL=`oc -n ${NAMESPACE} get route sonarqube -ojsonpath={.spec.host}`
cd sonarqube && ./configure.sh --sonarqube=${SONARQUBE_URL}
.PHONY: configure-sonarqube
# NEXUS
## Install or update Nexus.
install-nexus: apply-nexus
.PHONY: nexus
## Update OpenShift resources related to the Nexus service.
apply-nexus:
cd nexus/ocp-config && tailor apply --namespace ${NAMESPACE}
.PHONY: apply-nexus
## Configure Nexus service.
### Not part of install-nexus because it is not idempotent yet.
configure-nexus:
NEXUS_URL=`oc -n ${NAMESPACE} get route nexus3 -ojsonpath={.spec.host}`
cd nexus && ./configure.sh --namespace ${NAMESPACE} --nexus=${NEXUS_URL}
.PHONY: configure-nexus
# BACKUP
## Create a backup of the current state.
backup: backup-sonarqube backup-ocp-config
.PHONY: backup
## Create a backup of OpenShift resources in "cd" namespace.
backup-ocp-config:
tailor export --namespace ${NAMESPACE} > backup_cd.yml
.PHONY: backup-ocp-config
## Create a backup of the SonarQube database in the current directory.
backup-sonarqube:
cd sonarqube && ./backup.sh --namespace ${NAMESPACE} --backup-dir .
.PHONY: backup-sonarqube
# HELP
# Based on https://gist.github.com/prwhite/8168133#gistcomment-2278355.
help:
@echo ''
@echo 'Usage:'
@echo ' make <target>'
@echo ''
@echo 'Targets:'
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")-1); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " %-35s %s\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
.PHONY: help