-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
245 lines (213 loc) · 7.38 KB
/
.gitlab-ci.yml
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
variables:
WEBSITE_SRC: ${CI_PROJECT_DIR}/website
INFRA_SRC: ${CI_PROJECT_DIR}/infra
TEAMSPEAK_SRC: ${CI_PROJECT_DIR}/teamspeak
DEFIANT_SRC: ${CI_PROJECT_DIR}/defiant
CHARTMUSEUM_SRC: ${CI_PROJECT_DIR}/chartmuseum
ABITIBI_SRC: ${CI_PROJECT_DIR}/abitibi
ONETUN_SRC: ${CI_PROJECT_DIR}/onetun
TWITTON_SRC: ${CI_PROJECT_DIR}/twitton
TSACTIVITY_SRC: ${CI_PROJECT_DIR}/ts-activity
IMAGE_PREFIX: registry.gitlab.com/momothereal/momoperes.ca
WEBSITE_IMAGE: ${IMAGE_PREFIX}/website
DEFIANT_IMAGE: ${IMAGE_PREFIX}/defiant
ABITIBI_IMAGE: ${IMAGE_PREFIX}/abitibi
KUBECONFIG_PARENT: /etc/deploy
KUBECONFIG: ${KUBECONFIG_PARENT}/config
DEPLOY_NAMESPACE: public
stages:
- build
- release
- deploy
### WEBSITE ###
website:release:
stage: release
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- echo "Building to ${WEBSITE_IMAGE}:${CI_COMMIT_TAG}"
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"username\":\"${CI_REGISTRY_USER}\",\"password\":\"${CI_REGISTRY_PASSWORD}\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context ${WEBSITE_SRC} --dockerfile ${WEBSITE_SRC}/docker/Dockerfile --destination ${WEBSITE_IMAGE}:${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA} --destination ${WEBSITE_IMAGE}:${CI_COMMIT_REF_SLUG}
only:
changes:
- website/**/*
website:deploy:
stage: deploy
image: wavyfm/helm-kubectl-docker:v1.19.3-v3.4.2
script:
- mkdir -p ${KUBECONFIG_PARENT}
- echo ${K8S_CLUSTER_CONFIG} | base64 -d > ${KUBECONFIG}
# Deploy using helm chart
- cd ${WEBSITE_SRC}
- helm upgrade --install --namespace ${DEPLOY_NAMESPACE} --set image.name=${WEBSITE_IMAGE},image.tag=${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA} website ./chart/website
only:
refs:
- master
changes:
- website/**/*
### ABITIBI ###
abitibi:release:
stage: release
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- echo "Building to ${ABITIBI_IMAGE}:${CI_COMMIT_TAG}"
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"username\":\"${CI_REGISTRY_USER}\",\"password\":\"${CI_REGISTRY_PASSWORD}\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context ${ABITIBI_SRC} --dockerfile ${ABITIBI_SRC}/docker/Dockerfile --destination ${ABITIBI_IMAGE}:${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA} --destination ${ABITIBI_IMAGE}:${CI_COMMIT_REF_SLUG}
only:
changes:
- abitibi/**/*
abitibi:deploy:
stage: deploy
image: wavyfm/helm-kubectl-docker:v1.19.3-v3.4.2
script:
- mkdir -p ${KUBECONFIG_PARENT}
- echo ${K8S_CLUSTER_CONFIG} | base64 -d > ${KUBECONFIG}
# Deploy using helm chart
- cd ${ABITIBI_SRC}
- helm upgrade --install --namespace ${DEPLOY_NAMESPACE} --set image.name=${ABITIBI_IMAGE},image.tag=${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA} abitibi ./chart/abitibi
only:
refs:
- master
changes:
- abitibi/**/*
onetun-ntc-pdf-converter:deploy:
stage: deploy
image: wavyfm/helm-kubectl-docker:v1.19.3-v3.4.2
script:
- mkdir -p ${KUBECONFIG_PARENT}
- echo ${K8S_CLUSTER_CONFIG} | base64 -d > ${KUBECONFIG}
# Deploy using helm chart
- cd ${ONETUN_SRC}
- helm upgrade --install -n ${DEPLOY_NAMESPACE} -f ./ntc-pdf-converter.yml ntc-pdf-converter ./chart/onetun
only:
refs:
- master
changes:
- onetun/**/*
twitton:deploy:
stage: deploy
image: wavyfm/helm-kubectl-docker:v1.19.3-v3.4.2
script:
- mkdir -p ${KUBECONFIG_PARENT}
- echo ${K8S_CLUSTER_CONFIG} | base64 -d > ${KUBECONFIG}
# Deploy using helm chart
- cd ${TWITTON_SRC}
- helm upgrade --install -n ${DEPLOY_NAMESPACE} -f ./values.yaml twitton ./chart/twitton
only:
refs:
- master
changes:
- twitton/**/*
# INFRA #
infra:deploy:
stage: deploy
image: wavyfm/helm-kubectl-docker:v1.19.3-v3.4.2
script:
- mkdir -p ${KUBECONFIG_PARENT}
- echo ${K8S_CLUSTER_CONFIG} | base64 -d > ${KUBECONFIG}
# Deploy nginx ingress
# Note: Temporarily disabled due to issue with nginx-ingress and helm3 upgrades.
# - helm init --client-only && helm repo update
# - helm upgrade nginx-ingress stable/nginx-ingress --install --namespace ${DEPLOY_NAMESPACE} --set controller.publishService.enabled=true
# Deploy infra manifests directly
- cd ${INFRA_SRC}/
- kubectl apply --namespace ${DEPLOY_NAMESPACE} -R -f manifests/
only:
refs:
- master
changes:
- infra/**/*
# TEAMSPEAK #
teamspeak:deploy:
stage: deploy
image: wavyfm/helm-kubectl-docker:v1.19.3-v3.4.2
script:
- mkdir -p ${KUBECONFIG_PARENT}
- echo ${K8S_CLUSTER_CONFIG} | base64 -d > ${KUBECONFIG}
# Deploy using helm chart
- cd ${TEAMSPEAK_SRC}
- helm upgrade --install --namespace ${DEPLOY_NAMESPACE} teamspeak ./chart/teamspeak
only:
refs:
- master
changes:
- teamspeak/**/*
# TS-ACTIVITY #
ts-activity:deploy:
stage: deploy
image: wavyfm/helm-kubectl-docker:v1.19.3-v3.4.2
script:
- mkdir -p ${KUBECONFIG_PARENT}
- echo ${K8S_CLUSTER_CONFIG} | base64 -d > ${KUBECONFIG}
# Deploy using helm chart
- cd ${TSACTIVITY_SRC}
- helm repo add momoperes https://charts.momoperes.ca
- helm repo update
- helm upgrade --install --namespace ${DEPLOY_NAMESPACE} -f values.yaml ts-activity momoperes/ts-activity
only:
refs:
- master
changes:
- ts-activity/**/*
# DEFIANT #
#defiant:build:
# stage: build
# image: debian
# script:
# - apt-get update && apt-get install -y git
# - cd ${DEFIANT_SRC}/src
# - git clone https://github.com/momothereal/code-jam-2.git defiant
# - cp main_config.yaml defiant/config/main_config.yaml
# artifacts:
# paths:
# - ${DEFIANT_SRC}/src
# only:
# changes:
# - defiant/**/*
#defiant:release:
# stage: release
# image:
# name: gcr.io/kaniko-project/executor:debug
# entrypoint: [""]
# script:
# - echo "Building to ${DEFIANT_IMAGE}:${CI_COMMIT_TAG}"
# - echo "{\"auths\":{\"${CI_REGISTRY}\":{\"username\":\"${CI_REGISTRY_USER}\",\"password\":\"${CI_REGISTRY_PASSWORD}\"}}}" > /kaniko/.docker/config.json
# - /kaniko/executor --context ${DEFIANT_SRC}/src/defiant --dockerfile ${DEFIANT_SRC}/src/defiant/Dockerfile --destination ${DEFIANT_IMAGE}:${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA} --destination ${DEFIANT_IMAGE}:${CI_COMMIT_REF_SLUG}
# only:
# changes:
# - defiant/**/*
#defiant:deploy:
# stage: deploy
# image: wavyfm/helm-kubectl-docker:v1.18.8-v3.4.2
# script:
# - mkdir -p ${KUBECONFIG_PARENT}
# - echo ${K8S_CLUSTER_CONFIG} | base64 -d > ${KUBECONFIG}
#
# # Deploy using helm chart
# - cd ${DEFIANT_SRC}
# - helm init --client-only && helm repo update
# - helm upgrade --install --force --namespace ${DEPLOY_NAMESPACE} --set image.name=${DEFIANT_IMAGE},image.tag=${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA} defiant ./chart/defiant
# only:
# refs:
# - master
# changes:
# - defiant/**/*
# CHART MUSEUM #
chartmuseum:deploy:
stage: deploy
image: wavyfm/helm-kubectl-docker:v1.19.3-v3.4.2
script:
- mkdir -p ${KUBECONFIG_PARENT}
- echo ${K8S_CLUSTER_CONFIG} | base64 -d > ${KUBECONFIG}
# Deploy using helm chart
- cd ${CHARTMUSEUM_SRC}
- helm repo add chartmuseum https://chartmuseum.github.io/charts && helm repo update
- helm upgrade --install --namespace ${DEPLOY_NAMESPACE} -f values.yaml chartmuseum chartmuseum/chartmuseum
only:
refs:
- master
changes:
- chartmuseum/**/*