-
Notifications
You must be signed in to change notification settings - Fork 11
/
.gitlab-ci.yml
335 lines (291 loc) · 7.64 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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
image:
name: hashicorp/terraform:light
entrypoint:
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
stages:
- plan:simple-instance
- deploy:simple-instance
- destroy:simple-instance
- plan:simple-instance-v6
- deploy:simple-instance-v6
- destroy:simple-instance-v6
- plan:simple-objects
- deploy:simple-objects
- destroy:simple-objects
- plan:DNSaaS
- deploy:DNSaaS
- destroy:DNSaaS
- plan:lbaas
- deploy:lbaas
- destroy:lbaas
- plan:lbaas-octavia-http
- deploy:lbaas-octavia-http
- destroy:lbaas-octavia-http
- plan:lbaas-octavia-https
- deploy:lbaas-octavia-https
- destroy:lbaas-octavia-https
- plan:vpnaas
- deploy:vpnaas
- destroy:vpnaas
variables:
TF_VAR_ssh_publickey: $VAR_SSH_PUB_KEY
OS_AUTH_URL: $VAR_OS_AUTH_URL
OS_DOMAIN_NAME: $VAR_OS_DOMAIN_NAME
OS_PASSWORD: $VAR_OS_PASSWORD
OS_PROJECT_ID: $VAR_OS_PROJECT_ID
OS_PROJECT_NAME: $VAR_OS_PROJECT_NAME
OS_REGION_NAME: $VAR_OS_REGION_NAME
OS_USERNAME: $VAR_OS_USERNAME
###########
# Templates
###########
.terraform_plan: &terraform_plan
script:
- cd ${SERVICE}
- terraform init -input=false
- terraform validate
- terraform plan -out planfile
artifacts:
when: always
paths:
- ${SERVICE}/planfile
.terraform_apply: &terraform_apply
script:
- cd ${SERVICE}
- terraform init -input=false
- terraform validate
- terraform apply -input=false planfile
artifacts:
when: always
paths:
- ${SERVICE}/terraform.tfstate
.terraform_destroy: &terraform_destroy
script:
- cd ${SERVICE}
- terraform init -input=false
- terraform apply -destroy -input=false -auto-approve
artifacts:
when: always
paths:
- ${SERVICE}/terraform.tfstate
##############################
# Pipeline for simple-instance
##############################
Terraform simple-instance Plan:
<<: *terraform_plan
stage: plan:simple-instance
variables:
SERVICE: "simple-instance"
Terraform simple-instance Apply:
<<: *terraform_apply
stage: deploy:simple-instance
needs: ["Terraform simple-instance Plan"]
variables:
SERVICE: "simple-instance"
Terraform simple-instance Destroy:
<<: *terraform_destroy
stage: destroy:simple-instance
needs: ["Terraform simple-instance Apply"]
variables:
SERVICE: "simple-instance"
Terraform simple-instance Cleanup:
<<: *terraform_destroy
stage: deploy:simple-instance
needs: ["Terraform simple-instance Apply"]
when: on_failure
variables:
SERVICE: "simple-instance"
#################################
# Pipeline for simple-instance-v6
#################################
Terraform simple-instance-v6 Plan:
<<: *terraform_plan
stage: plan:simple-instance-v6
variables:
OS_REGION_NAME: "fes"
SERVICE: "simple-instance-v6"
Terraform simple-instance-v6 Apply:
<<: *terraform_apply
stage: deploy:simple-instance-v6
needs: ["Terraform simple-instance-v6 Plan"]
variables:
OS_REGION_NAME: "fes"
SERVICE: "simple-instance-v6"
Terraform simple-instance-v6 Destroy:
<<: *terraform_destroy
stage: destroy:simple-instance-v6
needs: ["Terraform simple-instance-v6 Apply"]
variables:
OS_REGION_NAME: "fes"
SERVICE: "simple-instance-v6"
Terraform simple-instance-v6 Cleanup:
<<: *terraform_destroy
stage: deploy:simple-instance-v6
needs: ["Terraform simple-instance-v6 Apply"]
when: on_failure
variables:
OS_REGION_NAME: "fes"
SERVICE: "simple-instance-v6"
#############################
# Pipeline for simple-objects
#############################
Terraform simple-objects Plan:
<<: *terraform_plan
stage: plan:simple-objects
variables:
SERVICE: "simple-objects"
Terraform simple-objects Apply:
<<: *terraform_apply
stage: deploy:simple-objects
needs: ["Terraform simple-objects Plan"]
variables:
SERVICE: "simple-objects"
Terraform simple-objects Destroy:
<<: *terraform_destroy
stage: destroy:simple-objects
needs: ["Terraform simple-objects Apply"]
variables:
SERVICE: "simple-objects"
Terraform simple-objects Cleanup:
<<: *terraform_destroy
stage: deploy:simple-objects
needs: ["Terraform simple-objects Apply"]
when: on_failure
variables:
SERVICE: "simple-objects"
#####################
# Pipeline for DNSaaS
#####################
Terraform DNSaaS Plan:
<<: *terraform_plan
stage: plan:DNSaaS
variables:
SERVICE: "DNSaaS"
Terraform DNSaaS Apply:
<<: *terraform_apply
stage: deploy:DNSaaS
needs: ["Terraform DNSaaS Plan"]
variables:
SERVICE: "DNSaaS"
Terraform DNSaaS Destroy:
<<: *terraform_destroy
stage: destroy:DNSaaS
needs: ["Terraform DNSaaS Apply"]
variables:
SERVICE: "DNSaaS"
Terraform DNSaaS Cleanup:
<<: *terraform_destroy
stage: deploy:DNSaaS
needs: ["Terraform DNSaaS Apply"]
when: on_failure
variables:
SERVICE: "DNSaaS"
####################
# Pipeline for lbaas
####################
Terraform lbaas Plan:
<<: *terraform_plan
stage: plan:lbaas
variables:
SERVICE: "lbaas"
Terraform lbaas Apply:
<<: *terraform_apply
needs: ["Terraform lbaas Plan"]
stage: deploy:lbaas
variables:
SERVICE: "lbaas"
Terraform lbaas Destroy:
<<: *terraform_destroy
stage: destroy:lbaas
needs: ["Terraform lbaas Apply"]
variables:
SERVICE: "lbaas"
Terraform lbaas Cleanup:
<<: *terraform_destroy
stage: deploy:lbaas
needs: ["Terraform lbaas Apply"]
when: on_failure
variables:
SERVICE: "lbaas"
#################################
# Pipeline for lbaas-octavia-http
#################################
Terraform lbaas-octavia-http Plan:
<<: *terraform_plan
stage: plan:lbaas-octavia-http
variables:
SERVICE: "lbaas-octavia-http"
Terraform lbaas-octavia-http Apply:
<<: *terraform_apply
stage: deploy:lbaas-octavia-http
needs: ["Terraform lbaas-octavia-http Plan"]
variables:
SERVICE: "lbaas-octavia-http"
Terraform lbaas-octavia-http Destroy:
<<: *terraform_destroy
stage: destroy:lbaas-octavia-http
needs: ["Terraform lbaas-octavia-http Apply"]
variables:
SERVICE: "lbaas-octavia-http"
Terraform lbaas-octavia-http Cleanup:
<<: *terraform_destroy
stage: deploy:lbaas-octavia-http
needs: ["Terraform lbaas-octavia-http Apply"]
when: on_failure
variables:
SERVICE: "lbaas-octavia-http"
##################################
# Pipeline for lbaas-octavia-https
##################################
Terraform lbaas-octavia-https Plan:
<<: *terraform_plan
stage: plan:lbaas-octavia-https
variables:
SERVICE: "lbaas-octavia-https"
Terraform lbaas-octavia-https Apply:
<<: *terraform_apply
stage: deploy:lbaas-octavia-https
needs: ["Terraform lbaas-octavia-https Plan"]
variables:
SERVICE: "lbaas-octavia-https"
Terraform lbaas-octavia-https Destroy:
<<: *terraform_destroy
stage: destroy:lbaas-octavia-https
needs: ["Terraform lbaas-octavia-https Apply"]
variables:
SERVICE: "lbaas-octavia-https"
Terraform lbaas-octavia-https Cleanup:
<<: *terraform_destroy
stage: deploy:lbaas-octavia-https
needs: ["Terraform lbaas-octavia-https Apply"]
when: on_failure
variables:
SERVICE: "lbaas-octavia-https"
#####################
# Pipeline for vpnaas
#####################
Terraform vpnaas Plan:
<<: *terraform_plan
stage: plan:vpnaas
variables:
SERVICE: "vpnaas"
Terraform vpnaas Apply:
<<: *terraform_apply
stage: deploy:vpnaas
needs: ["Terraform vpnaas Plan"]
variables:
SERVICE: "vpnaas"
Terraform vpnaas Destroy:
<<: *terraform_destroy
stage: destroy:vpnaas
needs: ["Terraform vpnaas Apply"]
variables:
SERVICE: "vpnaas"
Terraform vpnaas Cleanup:
<<: *terraform_destroy
stage: deploy:vpnaas
needs: ["Terraform vpnaas Apply"]
when: on_failure
variables:
SERVICE: "vpnaas"