prima-twig 0.34.8 → 0.34.127
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/bin/twig-build +2294 -0
- data/bin/twig-deploy +38 -75
- data/bin/twig-feature +297 -1592
- data/bin/twig-update-ami +100 -156
- data/lib/prima_aws_client.rb +267 -31
- data/lib/prima_twig.rb +5 -3
- metadata +119 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e1dad049494039e8bf03bd27a6f5e9152b17a9e3dbb5d6528bb76745ed8878e0
|
4
|
+
data.tar.gz: '073804fad37ceafaef1c355814d0f29cafc4eff80285815c05c02463dc1a0014'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7c072a3137124c3b47001e65ad77426d210bff9a4aff7f15f779d5cb97533e262be02ceb391e953c657b96191c85f709a1c3a5cd1c396309cb347831600ef58
|
7
|
+
data.tar.gz: 8324bf1c09b02248db9743bbf8f049222aa8c1e7e461101ef44b1cbb11d59cd179921fd314640a1e6f362c1f43f0294460f500bbe40703519bd38ff1879ed377
|
data/bin/twig-build
ADDED
@@ -0,0 +1,2294 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require_relative '../lib/prima_twig.rb'
|
5
|
+
require_relative '../lib/prima_aws_client.rb'
|
6
|
+
require 'digest'
|
7
|
+
require 'json'
|
8
|
+
require 'launchy'
|
9
|
+
require 'pp'
|
10
|
+
require 'redis'
|
11
|
+
|
12
|
+
class Build
|
13
|
+
include Command
|
14
|
+
include PrimaAwsClient
|
15
|
+
|
16
|
+
def initialize()
|
17
|
+
@prima = Prima.new
|
18
|
+
@batch = Aws::Batch::Client.new
|
19
|
+
@s3 = Aws::S3::Client.new
|
20
|
+
@s3_bucket = 'prima-artifacts'
|
21
|
+
@artifact_path = '/tmp/prima-artifact.zip'
|
22
|
+
@import_db_task = 'arn:aws:ecs:eu-west-1:001575623345:task-definition/ecs-task-db-restore2-TaskDefinitionDbRestore-XYF2QX2UJRXZ:1'
|
23
|
+
@cf_role = 'arn:aws:iam::001575623345:role/qainit-service-role-cloudformat-CloudformationRole-18KBZQIS148R9'
|
24
|
+
@ecs_cluster_name = nil
|
25
|
+
@deploy_update = false
|
26
|
+
@qainit = false
|
27
|
+
@qainit_host_folder = "/var/ci/#{ENV['DRONE_REPO']}/#{ENV['DRONE_BRANCH']}/#{ENV['DRONE_BUILD_NUMBER']}"
|
28
|
+
@qainit_folder = "/drone/src/github.com/project/primait/qainit"
|
29
|
+
@projects = {
|
30
|
+
'prima' => {},
|
31
|
+
'urania' => {},
|
32
|
+
'ermes' => {},
|
33
|
+
'bburago' => {},
|
34
|
+
'hal9000' => {},
|
35
|
+
'fidaty' => {},
|
36
|
+
'peano' => {},
|
37
|
+
'assange' => {},
|
38
|
+
'borat' => {},
|
39
|
+
'crash' => {},
|
40
|
+
'activia' => {},
|
41
|
+
'skynet' => {},
|
42
|
+
'roger' => {},
|
43
|
+
'rachele' => {},
|
44
|
+
'leftorium' => {},
|
45
|
+
'pyxis-npm' => {},
|
46
|
+
'starsky' => {},
|
47
|
+
'hutch' => {},
|
48
|
+
'maia' => {},
|
49
|
+
'legion' => {},
|
50
|
+
'vianello' => {},
|
51
|
+
'domus' => {},
|
52
|
+
'toretto' => {}
|
53
|
+
}
|
54
|
+
@base_stack_name_alb = 'ecs-alb-http-public-qa-'
|
55
|
+
@base_stack_name_alb_ws = 'ecs-alb-ws-public-qa-'
|
56
|
+
@git_branch = ENV['DRONE_BRANCH']
|
57
|
+
@cloudflare = Rubyflare.connect_with(ENV['CLOUDFLARE_EMAIL'], ENV['CLOUDFLARE_APIKEY'])
|
58
|
+
end
|
59
|
+
|
60
|
+
def execute!(args)
|
61
|
+
qainit_read_config!
|
62
|
+
abort('Non sei nella cartella di qainit') unless Dir.pwd.match 'qainit$' or Dir.pwd.match '/drone/src'
|
63
|
+
case args[0]
|
64
|
+
when 'infrastructure'
|
65
|
+
create_infrastructure_stacks! unless is_shutdown?
|
66
|
+
when 'project'
|
67
|
+
set_tags()
|
68
|
+
proj_method = "create_#{args[1]}_stack"
|
69
|
+
self.send(proj_method.to_sym) unless is_shutdown?
|
70
|
+
when 'complete'
|
71
|
+
if is_shutdown?
|
72
|
+
output 'Shutting down'.green
|
73
|
+
qainit_drone_shutdown!
|
74
|
+
else
|
75
|
+
complete_qa_setup!
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def is_shutdown?
|
81
|
+
return ENV['DRONE_COMMIT_MESSAGE'] == 'shutdown'
|
82
|
+
end
|
83
|
+
|
84
|
+
def qainit_drone_shutdown!
|
85
|
+
output "Recupero le informazioni sui QA attivi..."
|
86
|
+
stack_list, envs = get_stacks
|
87
|
+
|
88
|
+
env_hash = "qa-" + get_deploy_id
|
89
|
+
|
90
|
+
cluster_stack_name = nil
|
91
|
+
stacks_to_delete = []
|
92
|
+
stack_list.each do |stack|
|
93
|
+
if stack.stack_name.match(/#{env_hash}$/)
|
94
|
+
if stack.stack_name.match(/ecs-cluster/)
|
95
|
+
cluster_stack_name = stack.stack_name
|
96
|
+
else
|
97
|
+
break unless stack.stack_name.match(/#{env_hash}$/)
|
98
|
+
stacks_to_delete.push(stack.stack_name)
|
99
|
+
delete_stack(stack.stack_name)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
cluster_stack_name = "ecs-cluster-#{env_hash}"
|
105
|
+
if stack_exists?(cluster_stack_name)
|
106
|
+
aggregator_enabled = get_stack_tags(cluster_stack_name).detect do |tag|
|
107
|
+
tag.key === "hostname_pattern_priority" and tag.value === "1"
|
108
|
+
end.is_a?(Aws::CloudFormation::Types::Tag)
|
109
|
+
|
110
|
+
if aggregator_enabled
|
111
|
+
dns_to_staging(env_hash)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
# Se non ha finito di cancellare le altre non si puo' cancellare il cluster
|
116
|
+
output "Attendo 10 secondi per poter eliminare il cluster ECS"
|
117
|
+
|
118
|
+
while stacks_to_delete.length > 0
|
119
|
+
sleep 13
|
120
|
+
stacks_to_delete.each do |stack_name|
|
121
|
+
stacks_to_delete = stacks_to_delete - [stack_name] unless stack_exists?(stack_name)
|
122
|
+
end
|
123
|
+
output "Stack ancora attivi: #{stacks_to_delete.length.to_s}. Attendo altri 10 secondi per eliminare il cluster ECS"
|
124
|
+
end
|
125
|
+
|
126
|
+
delete_stack(cluster_stack_name) if stack_exists?(cluster_stack_name)
|
127
|
+
delete_stack(@base_stack_name_alb + env_hash[3..8]) if stack_exists?(@base_stack_name_alb + env_hash[3..8])
|
128
|
+
delete_stack(@base_stack_name_alb_ws + env_hash[3..8]) if stack_exists?(@base_stack_name_alb_ws + env_hash[3..8])
|
129
|
+
`git checkout master && git push origin --delete ${DRONE_BRANCH}`
|
130
|
+
output "Cancello il record DNS utilizzato da Lighthouse"
|
131
|
+
delete_lighthouse_dns()
|
132
|
+
output "Finito!".green
|
133
|
+
|
134
|
+
if @qainit
|
135
|
+
qainit_write_output("QA #{ENV["DRONE_BRANCH"]} spento.", 'Indirizzi scritti su ')
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def qainit_write_output(file_message, output_message)
|
140
|
+
`mkdir -p /etc/qainit-output`
|
141
|
+
qa_file_name = "/etc/qainit-output/url_qa"
|
142
|
+
File.open(qa_file_name + '.txt', 'w') { |file| file.write(file_message) }
|
143
|
+
output "#{output_message} #{qa_file_name}".green
|
144
|
+
end
|
145
|
+
|
146
|
+
def qainit_read_config!()
|
147
|
+
projects = ''
|
148
|
+
|
149
|
+
File.open('branch_names', 'r') do |file|
|
150
|
+
file.each_line do |line|
|
151
|
+
projects = JSON.parse(line)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
projects.each do |key, project|
|
156
|
+
@projects[key] = project
|
157
|
+
end
|
158
|
+
|
159
|
+
get_s3_config_files
|
160
|
+
@qainit = true
|
161
|
+
end
|
162
|
+
|
163
|
+
def get_s3_config_files
|
164
|
+
# manteniamo la struttura per lanciarlo facilmente anche da locale
|
165
|
+
`mkdir -p cloudformation/stacks/task cloudformation/stacks/route53 cloudformation/stacks/asg cloudformation/stacks/elb`
|
166
|
+
@s3.get_object({bucket: "prima-deploy", key: 'cloudformation/stacks/task/db.yml', response_target: 'cloudformation/stacks/task/db.yml'})
|
167
|
+
@s3.get_object({bucket: "prima-deploy", key: 'cloudformation/stacks/task/otel-agent.yml', response_target: 'cloudformation/stacks/task/otel-agent.yml'})
|
168
|
+
@s3.get_object({bucket: "prima-deploy", key: 'cloudformation/stacks/route53/qa.yml', response_target: 'cloudformation/stacks/route53/qa.yml'})
|
169
|
+
@s3.get_object({bucket: "prima-deploy", key: 'cloudformation/stacks/asg/ecs-asg-allinone.yml', response_target: 'cloudformation/stacks/asg/ecs-asg-allinone.yml'})
|
170
|
+
@s3.get_object({bucket: "prima-deploy", key: 'cloudformation/stacks/ecs-cluster.yml', response_target: 'cloudformation/stacks/ecs-cluster.yml'})
|
171
|
+
@s3.get_object({bucket: "prima-deploy", key: 'cloudformation/stacks/elb/alb-public-qa.yml', response_target: 'cloudformation/stacks/elb/alb-public-qa.yml'})
|
172
|
+
end
|
173
|
+
|
174
|
+
def get_deploy_id
|
175
|
+
if @deploy_id
|
176
|
+
@deploy_id
|
177
|
+
else
|
178
|
+
@deploy_id = Digest::MD5.hexdigest(ENV['DRONE_BRANCH'])
|
179
|
+
@deploy_id
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
def get_ecs_cluster_name
|
184
|
+
if @ecs_cluster_name
|
185
|
+
@ecs_cluster_name
|
186
|
+
else
|
187
|
+
cluster_stack_name = "ecs-cluster-qa-#{get_deploy_id}"
|
188
|
+
resp = describe_stack_resource(cluster_stack_name, 'ECSCluster')
|
189
|
+
@ecs_cluster_name = resp.stack_resource_detail.physical_resource_id
|
190
|
+
@ecs_cluster_name
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
def get_asg_stack_name
|
195
|
+
"ecs-asg-allinone-qa-#{get_deploy_id}"
|
196
|
+
end
|
197
|
+
|
198
|
+
def get_stack_name(service)
|
199
|
+
"ecs-task-#{service}-qa-#{get_deploy_id}"
|
200
|
+
end
|
201
|
+
|
202
|
+
def set_tags()
|
203
|
+
@tags = [
|
204
|
+
{
|
205
|
+
key: "qainit",
|
206
|
+
value: @git_branch.gsub(/[^a-zA-Z0-9\-]/,"-")
|
207
|
+
},
|
208
|
+
{
|
209
|
+
key: "hostname_pattern_priority",
|
210
|
+
value: hostname_pattern_priority
|
211
|
+
}
|
212
|
+
]
|
213
|
+
@projects.each do |key, value|
|
214
|
+
unless value['name'].to_s.strip.empty?
|
215
|
+
@tags << { key: key, value: value['name'] }
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
def create_infrastructure_stacks!
|
221
|
+
`git pull && git submodule init && git submodule update`
|
222
|
+
@ami_id = get_ami_id("ecs-fleet-allinone-staging")
|
223
|
+
deploy_id = get_deploy_id
|
224
|
+
stack_name_alb = 'ecs-alb-http-public-qa-' + deploy_id[0..5]
|
225
|
+
stack_name_alb_ws = 'ecs-alb-ws-public-qa-' + deploy_id[0..5]
|
226
|
+
unless @qainit
|
227
|
+
@projects.each_key do |project_key|
|
228
|
+
if @projects[project_key]['revision']
|
229
|
+
git_checkout_version(project_key, @projects[project_key]['revision'])
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
hostname_pattern_priority = hostname_pattern_priority()
|
234
|
+
|
235
|
+
set_tags()
|
236
|
+
|
237
|
+
cluster_stack_name = "ecs-cluster-qa-#{deploy_id}"
|
238
|
+
|
239
|
+
if stack_exists?(cluster_stack_name)
|
240
|
+
@tags = get_stack_tags(cluster_stack_name)
|
241
|
+
hostname_pattern_priority = @tags.detect do |tag|
|
242
|
+
tag.key == 'hostname_pattern_priority'
|
243
|
+
end.value
|
244
|
+
end
|
245
|
+
|
246
|
+
create_cluster_stack(cluster_stack_name, @tags) unless stack_exists?(cluster_stack_name)
|
247
|
+
wait_for_stack_ready(cluster_stack_name) unless stack_ready?(cluster_stack_name)
|
248
|
+
|
249
|
+
create_alb_stack(stack_name_alb, "http", deploy_id) unless stack_exists?(stack_name_alb)
|
250
|
+
create_alb_stack(stack_name_alb_ws, "websocket", deploy_id) unless stack_exists?(stack_name_alb_ws)
|
251
|
+
|
252
|
+
create_asg_stack(get_asg_stack_name, @tags) unless stack_exists?(get_asg_stack_name)
|
253
|
+
|
254
|
+
stack_name_db = "ecs-task-db-qa-#{deploy_id}"
|
255
|
+
stack_body = IO.read('cloudformation/stacks/task/db.yml')
|
256
|
+
parameters = [
|
257
|
+
{
|
258
|
+
parameter_key: "Environment",
|
259
|
+
parameter_value: "qa"
|
260
|
+
},
|
261
|
+
{
|
262
|
+
parameter_key: "ECSClusterName",
|
263
|
+
parameter_value: get_ecs_cluster_name
|
264
|
+
}
|
265
|
+
]
|
266
|
+
create_stack(stack_name_db, stack_body, parameters, @tags, @cf_role) unless stack_exists?(stack_name_db) # creazione asincrona stack dei db (~4 min)
|
267
|
+
|
268
|
+
output "check pyxis \n".yellow
|
269
|
+
|
270
|
+
wait_for_stack_ready(stack_name_db) unless stack_ready?(stack_name_db) # dovrebbe essere istantaneo
|
271
|
+
db_task = ''
|
272
|
+
db_task = import_dbs(get_ec2_ip_address) unless stack_exists?("ecs-route53-qa-#{deploy_id}") # import asincrono dei dati
|
273
|
+
|
274
|
+
wait_for_db_import(db_task) unless stack_exists?("ecs-route53-qa-#{deploy_id}") # dovrebbe essere istantaneo
|
275
|
+
|
276
|
+
import_redis_crash(get_ec2_ip_address) if !stack_exists?("ecs-task-web-qa-#{deploy_id}")
|
277
|
+
|
278
|
+
wait_for_stack_ready(stack_name_alb) unless stack_ready?(stack_name_alb)
|
279
|
+
wait_for_stack_ready(stack_name_alb_ws) unless stack_ready?(stack_name_alb_ws)
|
280
|
+
|
281
|
+
stack_name_route53 = "ecs-route53-qa-#{deploy_id}"
|
282
|
+
stack_body = IO.read('cloudformation/stacks/route53/qa.yml')
|
283
|
+
parameters = [
|
284
|
+
{
|
285
|
+
parameter_key: "DnsRecordIdentifier",
|
286
|
+
parameter_value: get_deploy_id
|
287
|
+
},
|
288
|
+
{
|
289
|
+
parameter_key: "PrimaElbHostname",
|
290
|
+
parameter_value: get_alb_host(stack_name_alb)
|
291
|
+
},
|
292
|
+
{
|
293
|
+
parameter_key: "UraniaIp",
|
294
|
+
parameter_value: get_ec2_ip_address
|
295
|
+
},
|
296
|
+
{
|
297
|
+
parameter_key: "BburagoIp",
|
298
|
+
parameter_value: get_ec2_ip_address
|
299
|
+
},
|
300
|
+
{
|
301
|
+
parameter_key: "Hal9000Ip",
|
302
|
+
parameter_value: get_ec2_ip_address
|
303
|
+
},
|
304
|
+
{
|
305
|
+
parameter_key: "FidatyIp",
|
306
|
+
parameter_value: get_ec2_ip_address
|
307
|
+
},
|
308
|
+
{
|
309
|
+
parameter_key: "PeanoIp",
|
310
|
+
parameter_value: get_ec2_ip_address
|
311
|
+
},
|
312
|
+
{
|
313
|
+
parameter_key: "ErmesIp",
|
314
|
+
parameter_value: get_ec2_ip_address
|
315
|
+
},
|
316
|
+
{
|
317
|
+
parameter_key: "ActiviaIp",
|
318
|
+
parameter_value: get_ec2_ip_address
|
319
|
+
},
|
320
|
+
{
|
321
|
+
parameter_key: "SkynetIp",
|
322
|
+
parameter_value: get_ec2_ip_address
|
323
|
+
},
|
324
|
+
{
|
325
|
+
parameter_key: "RogerIp",
|
326
|
+
parameter_value: get_ec2_ip_address
|
327
|
+
},
|
328
|
+
{
|
329
|
+
parameter_key: "LeftoriumIp",
|
330
|
+
parameter_value: get_ec2_ip_address
|
331
|
+
},
|
332
|
+
{
|
333
|
+
parameter_key: "RacheleIp",
|
334
|
+
parameter_value: get_ec2_ip_address
|
335
|
+
},
|
336
|
+
{
|
337
|
+
parameter_key: "RedisIp",
|
338
|
+
parameter_value: get_ec2_ip_address
|
339
|
+
},
|
340
|
+
{
|
341
|
+
parameter_key: "LegionIp",
|
342
|
+
parameter_value: get_ec2_ip_address
|
343
|
+
},
|
344
|
+
{
|
345
|
+
parameter_key: "AssangeElbHostname",
|
346
|
+
parameter_value: get_alb_host(stack_name_alb)
|
347
|
+
},
|
348
|
+
{
|
349
|
+
parameter_key: "BoratElbHostname",
|
350
|
+
parameter_value: get_alb_host(stack_name_alb_ws)
|
351
|
+
},
|
352
|
+
{
|
353
|
+
parameter_key: 'CrashElbHostname',
|
354
|
+
parameter_value: get_alb_host(stack_name_alb_ws)
|
355
|
+
},
|
356
|
+
{
|
357
|
+
parameter_key: 'StarskyElbHostname',
|
358
|
+
parameter_value: get_alb_host(stack_name_alb)
|
359
|
+
},
|
360
|
+
{
|
361
|
+
parameter_key: 'HutchElbHostname',
|
362
|
+
parameter_value: get_alb_host(stack_name_alb)
|
363
|
+
},
|
364
|
+
{
|
365
|
+
parameter_key: 'MaiaElbHostname',
|
366
|
+
parameter_value: get_alb_host(stack_name_alb)
|
367
|
+
},
|
368
|
+
{
|
369
|
+
parameter_key: 'VianelloElbHostname',
|
370
|
+
parameter_value: get_alb_host(stack_name_alb)
|
371
|
+
},
|
372
|
+
{
|
373
|
+
parameter_key: 'DomusElbHostname',
|
374
|
+
parameter_value: get_alb_host(stack_name_alb)
|
375
|
+
},
|
376
|
+
{
|
377
|
+
parameter_key: 'TorettoElbHostname',
|
378
|
+
parameter_value: get_alb_host(stack_name_alb)
|
379
|
+
},
|
380
|
+
{
|
381
|
+
parameter_key: 'TorettoFeElbHostname',
|
382
|
+
parameter_value: get_alb_host(stack_name_alb)
|
383
|
+
}
|
384
|
+
]
|
385
|
+
|
386
|
+
create_stack(stack_name_route53, stack_body, parameters, @tags, @cf_role) unless stack_exists?(stack_name_route53)
|
387
|
+
wait_for_stack_ready(stack_name_route53) unless stack_ready?(stack_name_route53)
|
388
|
+
|
389
|
+
stack_name_otel_agent = "ecs-task-otel-agent-qa-#{deploy_id}"
|
390
|
+
stack_body = IO.read('cloudformation/stacks/task/otel-agent.yml')
|
391
|
+
parameters = [
|
392
|
+
{
|
393
|
+
parameter_key: "Environment",
|
394
|
+
parameter_value: "qa"
|
395
|
+
},
|
396
|
+
{
|
397
|
+
parameter_key: "ClusterId",
|
398
|
+
parameter_value: get_ecs_cluster_name
|
399
|
+
},
|
400
|
+
{
|
401
|
+
parameter_key: "ConfigVersion",
|
402
|
+
parameter_value: "3.7.0"
|
403
|
+
}
|
404
|
+
]
|
405
|
+
create_stack(stack_name_otel_agent, stack_body, parameters, @tags, @cf_role) unless stack_exists?(stack_name_otel_agent)
|
406
|
+
end
|
407
|
+
|
408
|
+
def create_skynet_stack()
|
409
|
+
wait_for_artifact('prima-artifacts-encrypted', "microservices/skynet/#{@projects["skynet"]['revision']}-qa.tar.gz")
|
410
|
+
stack_name_skynet = get_stack_name("skynet")
|
411
|
+
git_checkout_version('skynet', @projects["skynet"]['revision'])
|
412
|
+
stack_body = File.read('projects/skynet/deploy/task.yml')
|
413
|
+
parameters = [
|
414
|
+
{
|
415
|
+
parameter_key: "Environment",
|
416
|
+
parameter_value: "qa"
|
417
|
+
},
|
418
|
+
{
|
419
|
+
parameter_key: "ReleaseVersion",
|
420
|
+
parameter_value: @projects["skynet"]['revision']
|
421
|
+
},
|
422
|
+
{
|
423
|
+
parameter_key: "TaskDesiredCount",
|
424
|
+
parameter_value: "1"
|
425
|
+
},
|
426
|
+
{
|
427
|
+
parameter_key: "ECSClusterName",
|
428
|
+
parameter_value: get_ecs_cluster_name
|
429
|
+
},
|
430
|
+
{
|
431
|
+
parameter_key: "HostnamePattern",
|
432
|
+
parameter_value: "skynet-#{get_deploy_id}.qa.colaster.com"
|
433
|
+
},
|
434
|
+
{
|
435
|
+
parameter_key: "HostnamePatternPriority",
|
436
|
+
parameter_value: hostname_pattern_priority
|
437
|
+
}
|
438
|
+
]
|
439
|
+
if stack_exists?(stack_name_skynet)
|
440
|
+
cur_version = get_currently_deployed_version(stack_name_skynet)
|
441
|
+
update_stack(stack_name_skynet, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["skynet"]['revision'])
|
442
|
+
else
|
443
|
+
create_stack(stack_name_skynet, stack_body, parameters, @tags, @cf_role)
|
444
|
+
end
|
445
|
+
end
|
446
|
+
|
447
|
+
def create_legion_stack()
|
448
|
+
wait_for_artifact('prima-artifacts-encrypted', "microservices/legion/#{@projects["legion"]['revision']}-qa.tar.gz")
|
449
|
+
stack_name_legion = get_stack_name("legion")
|
450
|
+
git_checkout_version('legion', @projects["legion"]['revision'])
|
451
|
+
stack_body = File.read('projects/legion/deploy/task.yml')
|
452
|
+
parameters = [
|
453
|
+
{
|
454
|
+
parameter_key: "Environment",
|
455
|
+
parameter_value: "qa"
|
456
|
+
},
|
457
|
+
{
|
458
|
+
parameter_key: "ReleaseVersion",
|
459
|
+
parameter_value: @projects["legion"]['revision']
|
460
|
+
},
|
461
|
+
{
|
462
|
+
parameter_key: "TaskDesiredCount",
|
463
|
+
parameter_value: "1"
|
464
|
+
},
|
465
|
+
{
|
466
|
+
parameter_key: "ECSClusterName",
|
467
|
+
parameter_value: get_ecs_cluster_name
|
468
|
+
},
|
469
|
+
{
|
470
|
+
parameter_key: "HostnamePattern",
|
471
|
+
parameter_value: "legion-#{get_deploy_id}.qa.colaster.com"
|
472
|
+
},
|
473
|
+
{
|
474
|
+
parameter_key: "HostnamePatternPriority",
|
475
|
+
parameter_value: hostname_pattern_priority
|
476
|
+
}
|
477
|
+
]
|
478
|
+
if stack_exists?(stack_name_legion)
|
479
|
+
cur_version = get_currently_deployed_version(stack_name_legion)
|
480
|
+
update_stack(stack_name_legion, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["legion"]['revision'])
|
481
|
+
else
|
482
|
+
create_stack(stack_name_legion, stack_body, parameters, @tags, @cf_role)
|
483
|
+
end
|
484
|
+
end
|
485
|
+
|
486
|
+
def create_urania_stack()
|
487
|
+
wait_for_artifact('prima-artifacts-encrypted', "microservices/urania/#{@projects["urania"]['revision']}-qa.tar.gz")
|
488
|
+
stack_name_urania = get_stack_name("urania")
|
489
|
+
git_checkout_version('urania', @projects["urania"]['revision'])
|
490
|
+
stack_body = File.read('projects/urania/deploy/task.yml')
|
491
|
+
parameters = [
|
492
|
+
{
|
493
|
+
parameter_key: "Environment",
|
494
|
+
parameter_value: "qa"
|
495
|
+
},
|
496
|
+
{
|
497
|
+
parameter_key: "ReleaseVersion",
|
498
|
+
parameter_value: @projects["urania"]['revision']
|
499
|
+
},
|
500
|
+
{
|
501
|
+
parameter_key: "TaskDesiredCount",
|
502
|
+
parameter_value: "1"
|
503
|
+
},
|
504
|
+
{
|
505
|
+
parameter_key: "ECSClusterName",
|
506
|
+
parameter_value: get_ecs_cluster_name
|
507
|
+
},
|
508
|
+
{
|
509
|
+
parameter_key: "HostnamePattern",
|
510
|
+
parameter_value: "urania-#{get_deploy_id}.qa.colaster.com"
|
511
|
+
},
|
512
|
+
{
|
513
|
+
parameter_key: "HostnamePatternPriority",
|
514
|
+
parameter_value: hostname_pattern_priority
|
515
|
+
}
|
516
|
+
]
|
517
|
+
if stack_exists?(stack_name_urania)
|
518
|
+
cur_version = get_currently_deployed_version(stack_name_urania)
|
519
|
+
update_stack(stack_name_urania, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["urania"]['revision'])
|
520
|
+
else
|
521
|
+
create_stack(stack_name_urania, stack_body, parameters, @tags, @cf_role)
|
522
|
+
end
|
523
|
+
end
|
524
|
+
|
525
|
+
def create_ermes_stack()
|
526
|
+
wait_for_artifact('prima-artifacts-encrypted', "microservices/ermes/#{@projects["ermes"]['revision']}-qa.tar.gz")
|
527
|
+
stack_name_ermes = get_stack_name("ermes")
|
528
|
+
git_checkout_version('ermes', @projects["ermes"]['revision'])
|
529
|
+
stack_body = File.read('projects/ermes/deploy/task.yml')
|
530
|
+
parameters = [
|
531
|
+
{
|
532
|
+
parameter_key: "Environment",
|
533
|
+
parameter_value: "qa"
|
534
|
+
},
|
535
|
+
{
|
536
|
+
parameter_key: "ReleaseVersion",
|
537
|
+
parameter_value: "#{@projects['ermes']['revision']}"
|
538
|
+
},
|
539
|
+
{
|
540
|
+
parameter_key: "TaskDesiredCount",
|
541
|
+
parameter_value: "1"
|
542
|
+
},
|
543
|
+
{
|
544
|
+
parameter_key: "ECSClusterName",
|
545
|
+
parameter_value: get_ecs_cluster_name
|
546
|
+
},
|
547
|
+
{
|
548
|
+
parameter_key: "HostnamePattern",
|
549
|
+
parameter_value: "ermes-#{get_deploy_id}.qa.colaster.com"
|
550
|
+
},
|
551
|
+
{
|
552
|
+
parameter_key: "HostnamePatternPriority",
|
553
|
+
parameter_value: hostname_pattern_priority
|
554
|
+
},
|
555
|
+
{
|
556
|
+
parameter_key: "WebHost",
|
557
|
+
parameter_value: get_route53_hostname('ecs-task-web-qa-notneeded')
|
558
|
+
},
|
559
|
+
{
|
560
|
+
parameter_key: "PeanoHost",
|
561
|
+
parameter_value: get_route53_hostname('ecs-task-peano-qa-notneeded')
|
562
|
+
}
|
563
|
+
]
|
564
|
+
if stack_exists?(stack_name_ermes)
|
565
|
+
cur_version = get_currently_deployed_version(stack_name_ermes)
|
566
|
+
update_stack(stack_name_ermes, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["ermes"]['revision'])
|
567
|
+
else
|
568
|
+
create_stack(stack_name_ermes, stack_body, parameters, @tags, @cf_role)
|
569
|
+
end
|
570
|
+
|
571
|
+
stack_name_ermes = get_stack_name("worker-ermes")
|
572
|
+
stack_body = File.read('projects/ermes/deploy/task-worker.yml')
|
573
|
+
parameters = [
|
574
|
+
{
|
575
|
+
parameter_key: "Environment",
|
576
|
+
parameter_value: "qa"
|
577
|
+
},
|
578
|
+
{
|
579
|
+
parameter_key: "ReleaseVersion",
|
580
|
+
parameter_value: "#{@projects['ermes']['revision']}"
|
581
|
+
},
|
582
|
+
{
|
583
|
+
parameter_key: "TaskDesiredCount",
|
584
|
+
parameter_value: "1"
|
585
|
+
},
|
586
|
+
{
|
587
|
+
parameter_key: "ECSClusterName",
|
588
|
+
parameter_value: get_ecs_cluster_name
|
589
|
+
},
|
590
|
+
{
|
591
|
+
parameter_key: "WebHost",
|
592
|
+
parameter_value: get_route53_hostname('ecs-task-web-qa-notneeded')
|
593
|
+
},
|
594
|
+
{
|
595
|
+
parameter_key: "PeanoHost",
|
596
|
+
parameter_value: get_route53_hostname('ecs-task-peano-qa-notneeded')
|
597
|
+
}
|
598
|
+
]
|
599
|
+
if stack_exists?(stack_name_ermes)
|
600
|
+
cur_version = get_currently_deployed_version(stack_name_ermes)
|
601
|
+
update_stack(stack_name_ermes, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["ermes"]['revision'])
|
602
|
+
else
|
603
|
+
create_stack(stack_name_ermes, stack_body, parameters, @tags, @cf_role)
|
604
|
+
end
|
605
|
+
end
|
606
|
+
|
607
|
+
def create_bburago_stack()
|
608
|
+
wait_for_artifact('prima-artifacts-encrypted', "microservices/bburago/#{@projects["bburago"]['revision']}-qa.tar.gz")
|
609
|
+
|
610
|
+
stack_name_bburago = get_stack_name("bburago")
|
611
|
+
git_checkout_version('bburago', @projects["bburago"]['revision'])
|
612
|
+
stack_body = File.read('projects/bburago/deploy/task.yml')
|
613
|
+
parameters = [
|
614
|
+
{
|
615
|
+
parameter_key: "Environment",
|
616
|
+
parameter_value: "qa"
|
617
|
+
},
|
618
|
+
{
|
619
|
+
parameter_key: "ReleaseVersion",
|
620
|
+
parameter_value: @projects["bburago"]['revision']
|
621
|
+
},
|
622
|
+
{
|
623
|
+
parameter_key: "ECSClusterName",
|
624
|
+
parameter_value: get_ecs_cluster_name
|
625
|
+
},
|
626
|
+
{
|
627
|
+
parameter_key: "TaskDesiredCount",
|
628
|
+
parameter_value: "1"
|
629
|
+
},
|
630
|
+
{
|
631
|
+
parameter_key: "HostnamePattern",
|
632
|
+
parameter_value: "bburago-#{get_deploy_id}.qa.colaster.com"
|
633
|
+
},
|
634
|
+
{
|
635
|
+
parameter_key: "HostnamePatternPriority",
|
636
|
+
parameter_value: hostname_pattern_priority
|
637
|
+
}
|
638
|
+
]
|
639
|
+
if stack_exists?(stack_name_bburago)
|
640
|
+
cur_version = get_currently_deployed_version(stack_name_bburago)
|
641
|
+
update_stack(stack_name_bburago, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["bburago"]['revision'])
|
642
|
+
else
|
643
|
+
create_stack(stack_name_bburago, stack_body, parameters, @tags, @cf_role)
|
644
|
+
end
|
645
|
+
end
|
646
|
+
|
647
|
+
def create_hal9000_stack()
|
648
|
+
wait_for_artifact('prima-artifacts-encrypted', "microservices/hal9000/#{@projects["hal9000"]['revision']}-qa.tar.gz")
|
649
|
+
|
650
|
+
stack_name_hal9000 = get_stack_name("hal9000")
|
651
|
+
git_checkout_version('hal9000', @projects["hal9000"]['revision'])
|
652
|
+
stack_body = File.read('projects/hal9000/deploy/task.yml')
|
653
|
+
parameters = [
|
654
|
+
{
|
655
|
+
parameter_key: "Environment",
|
656
|
+
parameter_value: "qa"
|
657
|
+
},
|
658
|
+
{
|
659
|
+
parameter_key: "ReleaseVersion",
|
660
|
+
parameter_value: @projects["hal9000"]['revision']
|
661
|
+
},
|
662
|
+
{
|
663
|
+
parameter_key: "ECSClusterName",
|
664
|
+
parameter_value: get_ecs_cluster_name
|
665
|
+
},
|
666
|
+
{
|
667
|
+
parameter_key: "TaskDesiredCount",
|
668
|
+
parameter_value: "1"
|
669
|
+
},
|
670
|
+
{
|
671
|
+
parameter_key: "HostnamePattern",
|
672
|
+
parameter_value: "hal9000-#{get_deploy_id}.qa.colaster.com"
|
673
|
+
},
|
674
|
+
{
|
675
|
+
parameter_key: "HostnamePatternPriority",
|
676
|
+
parameter_value: hostname_pattern_priority
|
677
|
+
}
|
678
|
+
]
|
679
|
+
if stack_exists?(stack_name_hal9000)
|
680
|
+
cur_version = get_currently_deployed_version(stack_name_hal9000)
|
681
|
+
update_stack(stack_name_hal9000, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["hal9000"]['revision'])
|
682
|
+
else
|
683
|
+
create_stack(stack_name_hal9000, stack_body, parameters, @tags, @cf_role)
|
684
|
+
end
|
685
|
+
end
|
686
|
+
|
687
|
+
def create_fidaty_stack()
|
688
|
+
wait_for_artifact('prima-artifacts-encrypted', "microservices/fidaty/#{@projects["fidaty"]['revision']}-qa.tar.gz")
|
689
|
+
|
690
|
+
stack_name_fidaty = get_stack_name("fidaty")
|
691
|
+
git_checkout_version('fidaty', @projects["fidaty"]['revision'])
|
692
|
+
stack_body = File.read('projects/fidaty/deploy/task.yml')
|
693
|
+
parameters = [
|
694
|
+
{
|
695
|
+
parameter_key: "Environment",
|
696
|
+
parameter_value: "qa"
|
697
|
+
},
|
698
|
+
{
|
699
|
+
parameter_key: "ReleaseVersion",
|
700
|
+
parameter_value: "#{@projects["fidaty"]['revision']}"
|
701
|
+
},
|
702
|
+
{
|
703
|
+
parameter_key: "ECSClusterName",
|
704
|
+
parameter_value: get_ecs_cluster_name
|
705
|
+
},
|
706
|
+
{
|
707
|
+
parameter_key: "TaskDesiredCount",
|
708
|
+
parameter_value: "1"
|
709
|
+
},
|
710
|
+
{
|
711
|
+
parameter_key: "HostnamePattern",
|
712
|
+
parameter_value: "fidaty-#{get_deploy_id}.qa.colaster.com"
|
713
|
+
},
|
714
|
+
{
|
715
|
+
parameter_key: "HostnamePatternPriority",
|
716
|
+
parameter_value: hostname_pattern_priority
|
717
|
+
},
|
718
|
+
{
|
719
|
+
parameter_key: "PeanoHost",
|
720
|
+
parameter_value: get_route53_hostname("ecs-task-peano-qa-notneeded")
|
721
|
+
}
|
722
|
+
]
|
723
|
+
if stack_exists?(stack_name_fidaty)
|
724
|
+
cur_version = get_currently_deployed_version(stack_name_fidaty)
|
725
|
+
update_stack(stack_name_fidaty, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["fidaty"]['revision'])
|
726
|
+
else
|
727
|
+
create_stack(stack_name_fidaty, stack_body, parameters, @tags, @cf_role)
|
728
|
+
end
|
729
|
+
end
|
730
|
+
|
731
|
+
def create_peano_stack()
|
732
|
+
wait_for_artifact('prima-artifacts-encrypted', "microservices/peano/#{@projects["peano"]['revision']}-qa.tar.gz")
|
733
|
+
|
734
|
+
stack_name_peano = get_stack_name("peano")
|
735
|
+
git_checkout_version('peano', @projects["peano"]['revision'])
|
736
|
+
stack_body = File.read('projects/peano/deploy/task.yml')
|
737
|
+
parameters = [
|
738
|
+
{
|
739
|
+
parameter_key: "Environment",
|
740
|
+
parameter_value: "qa"
|
741
|
+
},
|
742
|
+
{
|
743
|
+
parameter_key: "ReleaseVersion",
|
744
|
+
parameter_value: "#{@projects['peano']['revision']}"
|
745
|
+
},
|
746
|
+
{
|
747
|
+
parameter_key: "ECSClusterName",
|
748
|
+
parameter_value: get_ecs_cluster_name
|
749
|
+
},
|
750
|
+
{
|
751
|
+
parameter_key: "TaskDesiredCount",
|
752
|
+
parameter_value: "1"
|
753
|
+
},
|
754
|
+
{
|
755
|
+
parameter_key: "HostnamePattern",
|
756
|
+
parameter_value: "peano-#{get_deploy_id}.qa.colaster.com"
|
757
|
+
},
|
758
|
+
{
|
759
|
+
parameter_key: "HostnamePatternPriority",
|
760
|
+
parameter_value: hostname_pattern_priority
|
761
|
+
},
|
762
|
+
{
|
763
|
+
parameter_key: "WebHost",
|
764
|
+
parameter_value: "www-#{get_deploy_id}.qa.colaster.com"
|
765
|
+
}
|
766
|
+
]
|
767
|
+
if stack_exists?(stack_name_peano)
|
768
|
+
cur_version = get_currently_deployed_version(stack_name_peano)
|
769
|
+
update_stack(stack_name_peano, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["peano"]['revision'])
|
770
|
+
else
|
771
|
+
create_stack(stack_name_peano, stack_body, parameters, @tags, @cf_role)
|
772
|
+
end
|
773
|
+
end
|
774
|
+
|
775
|
+
def create_assange_stack()
|
776
|
+
wait_for_artifact('prima-artifacts-encrypted', "microservices/assange/#{@projects["assange"]['revision']}-qa.tar.gz")
|
777
|
+
|
778
|
+
stack_name_assange = get_stack_name("assange")
|
779
|
+
git_checkout_version('assange', @projects["assange"]['revision'])
|
780
|
+
stack_body = IO.read('projects/assange/deploy/task.yml')
|
781
|
+
parameters = [
|
782
|
+
{
|
783
|
+
parameter_key: "Environment",
|
784
|
+
parameter_value: "qa"
|
785
|
+
},
|
786
|
+
{
|
787
|
+
parameter_key: "ReleaseVersion",
|
788
|
+
parameter_value: "#{@projects["assange"]['revision']}"
|
789
|
+
},
|
790
|
+
{
|
791
|
+
parameter_key: "ECSClusterName",
|
792
|
+
parameter_value: get_ecs_cluster_name
|
793
|
+
},
|
794
|
+
{
|
795
|
+
parameter_key: "TaskDesiredCount",
|
796
|
+
parameter_value: "1"
|
797
|
+
},
|
798
|
+
{
|
799
|
+
parameter_key: "ALBShortName",
|
800
|
+
parameter_value: "assange-qa-#{get_deploy_id}"[0..27]
|
801
|
+
},
|
802
|
+
{
|
803
|
+
parameter_key: "HostnamePattern",
|
804
|
+
parameter_value: "assange-#{get_deploy_id}.qa.colaster.com"
|
805
|
+
},
|
806
|
+
{
|
807
|
+
parameter_key: "HostnamePatternPriority",
|
808
|
+
parameter_value: (hostname_pattern_priority.to_i + 20).to_s
|
809
|
+
},
|
810
|
+
{
|
811
|
+
parameter_key: "EnvHash",
|
812
|
+
parameter_value: get_deploy_id
|
813
|
+
},
|
814
|
+
{
|
815
|
+
parameter_key: "WebHost",
|
816
|
+
parameter_value: "www-#{get_deploy_id}.qa.colaster.com"
|
817
|
+
},
|
818
|
+
{
|
819
|
+
parameter_key: "AssangeHost",
|
820
|
+
parameter_value: "assange-#{get_deploy_id}.qa.colaster.com"
|
821
|
+
}
|
822
|
+
]
|
823
|
+
if stack_exists?(stack_name_assange)
|
824
|
+
cur_version = get_currently_deployed_version(stack_name_assange)
|
825
|
+
update_stack(stack_name_assange, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["assange"]['revision'])
|
826
|
+
else
|
827
|
+
create_stack(stack_name_assange, stack_body, parameters, @tags, @cf_role)
|
828
|
+
end
|
829
|
+
|
830
|
+
stack_name_assange_worker = get_stack_name("assange-worker")
|
831
|
+
git_checkout_version('assange', @projects["assange"]['revision'])
|
832
|
+
stack_body = IO.read('projects/assange/deploy/task-worker.yml')
|
833
|
+
parameters = [
|
834
|
+
{
|
835
|
+
parameter_key: "Environment",
|
836
|
+
parameter_value: "qa"
|
837
|
+
},
|
838
|
+
{
|
839
|
+
parameter_key: "ReleaseVersion",
|
840
|
+
parameter_value: "#{@projects["assange"]['revision']}"
|
841
|
+
},
|
842
|
+
{
|
843
|
+
parameter_key: "ECSClusterName",
|
844
|
+
parameter_value: get_ecs_cluster_name
|
845
|
+
},
|
846
|
+
{
|
847
|
+
parameter_key: "TaskDesiredCount",
|
848
|
+
parameter_value: "1"
|
849
|
+
},
|
850
|
+
{
|
851
|
+
parameter_key: "WebHost",
|
852
|
+
parameter_value: "www-#{get_deploy_id}.qa.colaster.com"
|
853
|
+
},
|
854
|
+
{
|
855
|
+
parameter_key: "AssangeHost",
|
856
|
+
parameter_value: "assange-#{get_deploy_id}.qa.colaster.com"
|
857
|
+
}
|
858
|
+
]
|
859
|
+
if stack_exists?(stack_name_assange_worker)
|
860
|
+
cur_version = get_currently_deployed_version(stack_name_assange_worker)
|
861
|
+
update_stack(stack_name_assange_worker, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["assange"]['revision'])
|
862
|
+
else
|
863
|
+
create_stack(stack_name_assange_worker, stack_body, parameters, @tags, @cf_role)
|
864
|
+
end
|
865
|
+
end
|
866
|
+
|
867
|
+
def create_leftorium_stack()
|
868
|
+
wait_for_artifact('prima-artifacts-encrypted', "microservices/leftorium/#{@projects["leftorium"]['revision']}-qa.tar.gz")
|
869
|
+
|
870
|
+
stack_name_leftorium = get_stack_name("leftorium")
|
871
|
+
git_checkout_version('leftorium', @projects["leftorium"]['revision'])
|
872
|
+
stack_body = File.read('projects/leftorium/deploy/task.yml')
|
873
|
+
parameters = [
|
874
|
+
{
|
875
|
+
parameter_key: "Environment",
|
876
|
+
parameter_value: "qa"
|
877
|
+
},
|
878
|
+
{
|
879
|
+
parameter_key: "ReleaseVersion",
|
880
|
+
parameter_value: "#{@projects["leftorium"]['revision']}"
|
881
|
+
},
|
882
|
+
{
|
883
|
+
parameter_key: "ECSClusterName",
|
884
|
+
parameter_value: get_ecs_cluster_name
|
885
|
+
},
|
886
|
+
{
|
887
|
+
parameter_key: "TaskDesiredCount",
|
888
|
+
parameter_value: "1"
|
889
|
+
},
|
890
|
+
{
|
891
|
+
parameter_key: "HostnamePattern",
|
892
|
+
parameter_value: "leftorium-#{get_deploy_id}.qa.colaster.com"
|
893
|
+
},
|
894
|
+
{
|
895
|
+
parameter_key: "HostnamePatternPriority",
|
896
|
+
parameter_value: hostname_pattern_priority
|
897
|
+
}
|
898
|
+
]
|
899
|
+
if stack_exists?(stack_name_leftorium)
|
900
|
+
cur_version = get_currently_deployed_version(stack_name_leftorium)
|
901
|
+
update_stack(stack_name_leftorium, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["leftorium"]['revision'])
|
902
|
+
else
|
903
|
+
create_stack(stack_name_leftorium, stack_body, parameters, @tags, @cf_role)
|
904
|
+
end
|
905
|
+
end
|
906
|
+
|
907
|
+
def create_rachele_stack()
|
908
|
+
wait_for_artifact('prima-artifacts-encrypted', "microservices/rachele/#{@projects["rachele"]['revision']}-qa.tar.gz")
|
909
|
+
|
910
|
+
stack_name_rachele = get_stack_name("rachele")
|
911
|
+
git_checkout_version('rachele', @projects["rachele"]['revision'])
|
912
|
+
stack_body = File.read('projects/rachele/deploy/task.yml')
|
913
|
+
parameters = [
|
914
|
+
{
|
915
|
+
parameter_key: "Environment",
|
916
|
+
parameter_value: "qa"
|
917
|
+
},
|
918
|
+
{
|
919
|
+
parameter_key: "ReleaseVersion",
|
920
|
+
parameter_value: "#{@projects["rachele"]['revision']}"
|
921
|
+
},
|
922
|
+
{
|
923
|
+
parameter_key: "ECSClusterName",
|
924
|
+
parameter_value: get_ecs_cluster_name
|
925
|
+
},
|
926
|
+
{
|
927
|
+
parameter_key: "TaskDesiredCount",
|
928
|
+
parameter_value: "1"
|
929
|
+
},
|
930
|
+
{
|
931
|
+
parameter_key: "EnvHash",
|
932
|
+
parameter_value: get_deploy_id
|
933
|
+
},
|
934
|
+
{
|
935
|
+
parameter_key: "WebHost",
|
936
|
+
parameter_value: "www-#{get_deploy_id}.qa.colaster.com"
|
937
|
+
},
|
938
|
+
{
|
939
|
+
parameter_key: "HostnamePattern",
|
940
|
+
parameter_value: "rachele-#{get_deploy_id}.qa.colaster.com"
|
941
|
+
},
|
942
|
+
{
|
943
|
+
parameter_key: "HostnamePatternPriority",
|
944
|
+
parameter_value: hostname_pattern_priority
|
945
|
+
}
|
946
|
+
]
|
947
|
+
if stack_exists?(stack_name_rachele)
|
948
|
+
cur_version = get_currently_deployed_version(stack_name_rachele)
|
949
|
+
unless cur_version.include?(@projects["rachele"]['revision'])
|
950
|
+
delete_stack(stack_name_rachele)
|
951
|
+
wait_for_stack_removal(stack_name_rachele)
|
952
|
+
create_stack(stack_name_rachele, stack_body, parameters, @tags, @cf_role)
|
953
|
+
end
|
954
|
+
else
|
955
|
+
create_stack(stack_name_rachele, stack_body, parameters, @tags, @cf_role)
|
956
|
+
end
|
957
|
+
end
|
958
|
+
|
959
|
+
def create_borat_stack()
|
960
|
+
wait_for_artifact('prima-artifacts-encrypted', "microservices/borat/#{@projects["borat"]['revision']}-qa.tar.gz")
|
961
|
+
|
962
|
+
stack_name_borat = get_stack_name("borat")
|
963
|
+
git_checkout_version('borat', @projects["borat"]['revision'])
|
964
|
+
stack_body = IO.read('projects/borat/deploy/task.yml')
|
965
|
+
parameters = [
|
966
|
+
{
|
967
|
+
parameter_key: "Environment",
|
968
|
+
parameter_value: "qa"
|
969
|
+
},
|
970
|
+
{
|
971
|
+
parameter_key: "ReleaseVersion",
|
972
|
+
parameter_value: "#{@projects["borat"]['revision']}"
|
973
|
+
},
|
974
|
+
{
|
975
|
+
parameter_key: "ECSClusterName",
|
976
|
+
parameter_value: get_ecs_cluster_name
|
977
|
+
},
|
978
|
+
{
|
979
|
+
parameter_key: "TaskDesiredCount",
|
980
|
+
parameter_value: "1"
|
981
|
+
},
|
982
|
+
{
|
983
|
+
parameter_key: "ALBShortName",
|
984
|
+
parameter_value: "borat-qa-#{get_deploy_id}"[0..27]
|
985
|
+
},
|
986
|
+
{
|
987
|
+
parameter_key: "HostnamePattern",
|
988
|
+
parameter_value: "backoffice-#{get_deploy_id}.qa.colaster.com"
|
989
|
+
},
|
990
|
+
{
|
991
|
+
parameter_key: "HostnamePatternPriority",
|
992
|
+
parameter_value: (hostname_pattern_priority.to_i + 30).to_s
|
993
|
+
},
|
994
|
+
{
|
995
|
+
parameter_key: "EnvHash",
|
996
|
+
parameter_value: get_deploy_id
|
997
|
+
},
|
998
|
+
{
|
999
|
+
parameter_key: "WsEndpoint",
|
1000
|
+
parameter_value: "wss://backoffice-#{get_deploy_id}.qa.colaster.com/socket/websocket?vsn=1.0.0"
|
1001
|
+
},
|
1002
|
+
{
|
1003
|
+
parameter_key: "GraphqlEndpoint",
|
1004
|
+
parameter_value: "https://backoffice-#{get_deploy_id}.qa.colaster.com/graphql"
|
1005
|
+
},
|
1006
|
+
{
|
1007
|
+
parameter_key: "GraphqlInsuranceEndpoint",
|
1008
|
+
parameter_value: "https://backoffice-#{get_deploy_id}.qa.colaster.com/graphql/insurance"
|
1009
|
+
},
|
1010
|
+
{
|
1011
|
+
parameter_key: "AuthEndpoint",
|
1012
|
+
parameter_value: "https://backoffice-#{get_deploy_id}.qa.colaster.com/auth"
|
1013
|
+
},
|
1014
|
+
{
|
1015
|
+
parameter_key: "FrontendEndpoint",
|
1016
|
+
parameter_value: "https://www-#{get_deploy_id}.qa.colaster.com/"
|
1017
|
+
}
|
1018
|
+
]
|
1019
|
+
if stack_exists?(stack_name_borat)
|
1020
|
+
cur_version = get_currently_deployed_version(stack_name_borat)
|
1021
|
+
update_stack(stack_name_borat, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["borat"]['revision'])
|
1022
|
+
else
|
1023
|
+
create_stack(stack_name_borat, stack_body, parameters, @tags, @cf_role)
|
1024
|
+
end
|
1025
|
+
end
|
1026
|
+
|
1027
|
+
def create_crash_stack()
|
1028
|
+
wait_for_artifact('prima-artifacts-encrypted', "microservices/crash/#{@projects['crash']['revision']}-qa.tar.gz")
|
1029
|
+
|
1030
|
+
stack_name_crash = get_stack_name("crash")
|
1031
|
+
git_checkout_version('crash', @projects['crash']['revision'])
|
1032
|
+
stack_body = IO.read('projects/crash/deploy/task.yml')
|
1033
|
+
parameters = [
|
1034
|
+
{
|
1035
|
+
parameter_key: 'Environment',
|
1036
|
+
parameter_value: 'qa'
|
1037
|
+
},
|
1038
|
+
{
|
1039
|
+
parameter_key: 'ReleaseVersion',
|
1040
|
+
parameter_value: "#{@projects['crash']['revision']}"
|
1041
|
+
},
|
1042
|
+
{
|
1043
|
+
parameter_key: 'TaskDesiredCount',
|
1044
|
+
parameter_value: '1'
|
1045
|
+
},
|
1046
|
+
{
|
1047
|
+
parameter_key: 'ECSClusterName',
|
1048
|
+
parameter_value: get_ecs_cluster_name
|
1049
|
+
},
|
1050
|
+
{
|
1051
|
+
parameter_key: 'ALBShortName',
|
1052
|
+
parameter_value: "crash-qa-#{get_deploy_id}"[0..27]
|
1053
|
+
},
|
1054
|
+
{
|
1055
|
+
parameter_key: 'HostnamePattern',
|
1056
|
+
parameter_value: "crash-#{get_deploy_id}.qa.colaster.com"
|
1057
|
+
},
|
1058
|
+
{
|
1059
|
+
parameter_key: 'HostnamePatternPriority',
|
1060
|
+
parameter_value: (hostname_pattern_priority.to_i + 10).to_s
|
1061
|
+
},
|
1062
|
+
{
|
1063
|
+
parameter_key: "EnvHash",
|
1064
|
+
parameter_value: get_deploy_id
|
1065
|
+
},
|
1066
|
+
{
|
1067
|
+
parameter_key: "WsEndpoint",
|
1068
|
+
parameter_value: "wss://crash-#{get_deploy_id}.qa.colaster.com/socket/websocket?vsn=1.0.0"
|
1069
|
+
},
|
1070
|
+
{
|
1071
|
+
parameter_key: "GraphqlEndpoint",
|
1072
|
+
parameter_value: "https://crash-#{get_deploy_id}.qa.colaster.com/graphql"
|
1073
|
+
},
|
1074
|
+
{
|
1075
|
+
parameter_key: "AuthDomain",
|
1076
|
+
parameter_value: "https://www-#{get_deploy_id}.qa.colaster.com/"
|
1077
|
+
},
|
1078
|
+
]
|
1079
|
+
if stack_exists?(stack_name_crash)
|
1080
|
+
cur_version = get_currently_deployed_version(stack_name_crash)
|
1081
|
+
update_stack(stack_name_crash, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["crash"]['revision'])
|
1082
|
+
else
|
1083
|
+
create_stack(stack_name_crash, stack_body, parameters, @tags, @cf_role)
|
1084
|
+
end
|
1085
|
+
end
|
1086
|
+
|
1087
|
+
def create_starsky_stack()
|
1088
|
+
wait_for_artifact('prima-artifacts-encrypted', "microservices/starsky/#{@projects["starsky"]['revision']}-qa.tar.gz")
|
1089
|
+
|
1090
|
+
git_checkout_version('starsky', @projects["starsky"]['revision'])
|
1091
|
+
stack_name_starsky = get_stack_name("starsky")
|
1092
|
+
stack_body = IO.read('projects/starsky/deploy/task.yml')
|
1093
|
+
parameters = [
|
1094
|
+
{
|
1095
|
+
parameter_key: "Environment",
|
1096
|
+
parameter_value: "qa"
|
1097
|
+
},
|
1098
|
+
{
|
1099
|
+
parameter_key: "ReleaseVersion",
|
1100
|
+
parameter_value: "#{@projects["starsky"]['revision']}"
|
1101
|
+
},
|
1102
|
+
{
|
1103
|
+
parameter_key: "TaskDesiredCount",
|
1104
|
+
parameter_value: "1"
|
1105
|
+
},
|
1106
|
+
{
|
1107
|
+
parameter_key: "ECSClusterName",
|
1108
|
+
parameter_value: get_ecs_cluster_name
|
1109
|
+
},
|
1110
|
+
{
|
1111
|
+
parameter_key: "ALBShortName",
|
1112
|
+
parameter_value: "starsky-qa-#{get_deploy_id}"[0..27]
|
1113
|
+
},
|
1114
|
+
{
|
1115
|
+
parameter_key: "EnvHash",
|
1116
|
+
parameter_value: get_deploy_id
|
1117
|
+
},
|
1118
|
+
{
|
1119
|
+
parameter_key: "HostnamePattern",
|
1120
|
+
parameter_value: "starsky-#{get_deploy_id}.qa.colaster.com"
|
1121
|
+
},
|
1122
|
+
{
|
1123
|
+
parameter_key: "HostnamePatternPriority",
|
1124
|
+
parameter_value: (hostname_pattern_priority.to_i + 74).to_s
|
1125
|
+
}
|
1126
|
+
]
|
1127
|
+
if stack_exists?(stack_name_starsky)
|
1128
|
+
cur_version = get_currently_deployed_version(stack_name_starsky)
|
1129
|
+
unless cur_version.include?(@projects["starsky"]['revision'])
|
1130
|
+
delete_stack(stack_name_starsky)
|
1131
|
+
wait_for_stack_removal(stack_name_starsky)
|
1132
|
+
create_stack(stack_name_starsky, stack_body, parameters, @tags, @cf_role)
|
1133
|
+
end
|
1134
|
+
else
|
1135
|
+
create_stack(stack_name_starsky, stack_body, parameters, @tags, @cf_role)
|
1136
|
+
end
|
1137
|
+
end
|
1138
|
+
|
1139
|
+
def create_activia_stack()
|
1140
|
+
wait_for_artifact('prima-artifacts-encrypted', "microservices/activia/#{@projects["activia"]['revision']}-qa.tar.gz")
|
1141
|
+
|
1142
|
+
stack_name_activia = get_stack_name("activia")
|
1143
|
+
git_checkout_version('activia', @projects["activia"]['revision'])
|
1144
|
+
stack_body = File.read('projects/activia/deploy/task.yml')
|
1145
|
+
parameters = [
|
1146
|
+
{
|
1147
|
+
parameter_key: "Environment",
|
1148
|
+
parameter_value: "qa"
|
1149
|
+
},
|
1150
|
+
{
|
1151
|
+
parameter_key: "ReleaseVersion",
|
1152
|
+
parameter_value: "#{@projects["activia"]['revision']}"
|
1153
|
+
},
|
1154
|
+
{
|
1155
|
+
parameter_key: "ECSClusterName",
|
1156
|
+
parameter_value: get_ecs_cluster_name
|
1157
|
+
},
|
1158
|
+
{
|
1159
|
+
parameter_key: "TaskDesiredCount",
|
1160
|
+
parameter_value: "1"
|
1161
|
+
},
|
1162
|
+
{
|
1163
|
+
parameter_key: "HostnamePattern",
|
1164
|
+
parameter_value: "activia-#{get_deploy_id}.qa.colaster.com"
|
1165
|
+
},
|
1166
|
+
{
|
1167
|
+
parameter_key: "HostnamePatternPriority",
|
1168
|
+
parameter_value: hostname_pattern_priority
|
1169
|
+
},
|
1170
|
+
{
|
1171
|
+
parameter_key: "WebHost",
|
1172
|
+
parameter_value: get_route53_hostname('ecs-task-web-qa-notneeded')
|
1173
|
+
},
|
1174
|
+
{
|
1175
|
+
parameter_key: "PeanoHost",
|
1176
|
+
parameter_value: get_route53_hostname('ecs-task-peano-qa-notneeded')
|
1177
|
+
}
|
1178
|
+
]
|
1179
|
+
if stack_exists?(stack_name_activia)
|
1180
|
+
cur_version = get_currently_deployed_version(stack_name_activia)
|
1181
|
+
update_stack(stack_name_activia, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["activia"]['revision'])
|
1182
|
+
else
|
1183
|
+
create_stack(stack_name_activia, stack_body, parameters, @tags, @cf_role)
|
1184
|
+
end
|
1185
|
+
end
|
1186
|
+
|
1187
|
+
def create_web_stack()
|
1188
|
+
wait_for_artifact('prima-artifacts-encrypted', "prima/#{@projects["prima"]['revision']}.tar.gz")
|
1189
|
+
# Waiting for prima healtcheck dependencies
|
1190
|
+
wait_for_stack_ready(get_stack_name("skynet")) unless stack_ready?(get_stack_name("skynet"))
|
1191
|
+
wait_for_stack_ready(get_stack_name("urania")) unless stack_ready?(get_stack_name("urania"))
|
1192
|
+
wait_for_stack_ready(get_stack_name("bburago")) unless stack_ready?(get_stack_name("bburago"))
|
1193
|
+
wait_for_stack_ready(get_stack_name("hal9000")) unless stack_ready?(get_stack_name("hal9000"))
|
1194
|
+
wait_for_stack_ready(get_stack_name("assange")) unless stack_ready?(get_stack_name("assange"))
|
1195
|
+
wait_for_stack_ready(get_stack_name("fidaty")) unless stack_ready?(get_stack_name("fidaty"))
|
1196
|
+
wait_for_stack_ready(get_stack_name("leftorium")) unless stack_ready?(get_stack_name("leftorium"))
|
1197
|
+
wait_for_stack_ready(get_stack_name("rachele")) unless stack_ready?(get_stack_name("rachele"))
|
1198
|
+
stack_name_web = get_stack_name("web")
|
1199
|
+
git_checkout_version('prima', @projects["prima"]['revision'])
|
1200
|
+
stack_body = IO.read('projects/prima/app/cloudformation/tasks/web.yml')
|
1201
|
+
parameters = [
|
1202
|
+
{
|
1203
|
+
parameter_key: "Environment",
|
1204
|
+
parameter_value: "qa"
|
1205
|
+
},
|
1206
|
+
{
|
1207
|
+
parameter_key: "ReleaseVersion",
|
1208
|
+
parameter_value: "#{@projects["prima"]['revision']}"
|
1209
|
+
},
|
1210
|
+
{
|
1211
|
+
parameter_key: "TaskDesiredCount",
|
1212
|
+
parameter_value: "1"
|
1213
|
+
},
|
1214
|
+
{
|
1215
|
+
parameter_key: "ECSClusterName",
|
1216
|
+
parameter_value: get_ecs_cluster_name
|
1217
|
+
},
|
1218
|
+
{
|
1219
|
+
parameter_key: "ALBShortName",
|
1220
|
+
parameter_value: "web-qa-#{get_deploy_id}"[0..27]
|
1221
|
+
},
|
1222
|
+
{
|
1223
|
+
parameter_key: "HostnamePatternPriority",
|
1224
|
+
parameter_value: hostname_pattern_priority
|
1225
|
+
},
|
1226
|
+
{
|
1227
|
+
parameter_key: "HostnamePatternAggregatorPriority",
|
1228
|
+
parameter_value: (hostname_pattern_priority.to_i + 1).to_s
|
1229
|
+
},
|
1230
|
+
{
|
1231
|
+
parameter_key: "EnvHash",
|
1232
|
+
parameter_value: get_deploy_id
|
1233
|
+
},
|
1234
|
+
{
|
1235
|
+
parameter_key: "HostnamePattern",
|
1236
|
+
parameter_value: "www-#{get_deploy_id}.*"
|
1237
|
+
}
|
1238
|
+
]
|
1239
|
+
if stack_exists?(stack_name_web)
|
1240
|
+
cur_version = get_currently_deployed_version(stack_name_web)
|
1241
|
+
update_stack(stack_name_web, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["prima"]['revision'])
|
1242
|
+
else
|
1243
|
+
create_stack(stack_name_web, stack_body, parameters, @tags, @cf_role)
|
1244
|
+
end
|
1245
|
+
end
|
1246
|
+
|
1247
|
+
def create_consumer_stack()
|
1248
|
+
wait_for_artifact('prima-artifacts-encrypted', "prima/#{@projects["prima"]['revision']}.tar.gz")
|
1249
|
+
# Waiting for prima healtcheck dependencies
|
1250
|
+
wait_for_stack_ready(get_stack_name("skynet")) unless stack_ready?(get_stack_name("skynet"))
|
1251
|
+
wait_for_stack_ready(get_stack_name("urania")) unless stack_ready?(get_stack_name("urania"))
|
1252
|
+
wait_for_stack_ready(get_stack_name("bburago")) unless stack_ready?(get_stack_name("bburago"))
|
1253
|
+
wait_for_stack_ready(get_stack_name("hal9000")) unless stack_ready?(get_stack_name("hal9000"))
|
1254
|
+
wait_for_stack_ready(get_stack_name("assange")) unless stack_ready?(get_stack_name("assange"))
|
1255
|
+
wait_for_stack_ready(get_stack_name("fidaty")) unless stack_ready?(get_stack_name("fidaty"))
|
1256
|
+
wait_for_stack_ready(get_stack_name("leftorium")) unless stack_ready?(get_stack_name("leftorium"))
|
1257
|
+
wait_for_stack_ready(get_stack_name("rachele")) unless stack_ready?(get_stack_name("rachele"))
|
1258
|
+
stack_name_consumer = get_stack_name("consumer")
|
1259
|
+
git_checkout_version('prima', @projects["prima"]['revision'])
|
1260
|
+
stack_body = IO.read('projects/prima/app/cloudformation/tasks/consumer.yml')
|
1261
|
+
parameters = [
|
1262
|
+
{
|
1263
|
+
parameter_key: "Environment",
|
1264
|
+
parameter_value: "qa"
|
1265
|
+
},
|
1266
|
+
{
|
1267
|
+
parameter_key: "ReleaseVersion",
|
1268
|
+
parameter_value: "#{@projects["prima"]['revision']}"
|
1269
|
+
},
|
1270
|
+
{
|
1271
|
+
parameter_key: "ECSClusterName",
|
1272
|
+
parameter_value: get_ecs_cluster_name
|
1273
|
+
},
|
1274
|
+
{
|
1275
|
+
parameter_key: "EnvHash",
|
1276
|
+
parameter_value: get_deploy_id
|
1277
|
+
}
|
1278
|
+
]
|
1279
|
+
if stack_exists?(stack_name_consumer)
|
1280
|
+
cur_version = get_currently_deployed_version(stack_name_consumer)
|
1281
|
+
update_stack(stack_name_consumer, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["prima"]['revision'])
|
1282
|
+
else
|
1283
|
+
create_stack(stack_name_consumer, stack_body, parameters, @tags, @cf_role)
|
1284
|
+
end
|
1285
|
+
|
1286
|
+
stack_name_consumer_api = get_stack_name("consumer-api")
|
1287
|
+
stack_body = IO.read('projects/prima/app/cloudformation/tasks/consumer-api.yml')
|
1288
|
+
parameters = [
|
1289
|
+
{
|
1290
|
+
parameter_key: "Environment",
|
1291
|
+
parameter_value: "qa"
|
1292
|
+
},
|
1293
|
+
{
|
1294
|
+
parameter_key: "ReleaseVersion",
|
1295
|
+
parameter_value: "#{@projects["prima"]['revision']}"
|
1296
|
+
},
|
1297
|
+
{
|
1298
|
+
parameter_key: "ECSClusterName",
|
1299
|
+
parameter_value: get_ecs_cluster_name
|
1300
|
+
},
|
1301
|
+
{
|
1302
|
+
parameter_key: "EnvHash",
|
1303
|
+
parameter_value: get_deploy_id
|
1304
|
+
},
|
1305
|
+
{
|
1306
|
+
parameter_key: "HostnamePattern",
|
1307
|
+
parameter_value: "consumer-#{get_deploy_id}.qa.colaster.com"
|
1308
|
+
}
|
1309
|
+
]
|
1310
|
+
if stack_exists?(stack_name_consumer_api)
|
1311
|
+
cur_version = get_currently_deployed_version(stack_name_consumer_api)
|
1312
|
+
update_stack(stack_name_consumer_api, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["prima"]['revision'])
|
1313
|
+
else
|
1314
|
+
create_stack(stack_name_consumer_api, stack_body, parameters, @tags, @cf_role)
|
1315
|
+
end
|
1316
|
+
end
|
1317
|
+
|
1318
|
+
def create_roger_stack()
|
1319
|
+
wait_for_artifact('prima-artifacts-encrypted', "microservices/roger/#{@projects["roger"]['revision']}-qa.tar.gz")
|
1320
|
+
wait_for_stack_ready(get_stack_name("consumer")) unless stack_ready?(get_stack_name("consumer"))
|
1321
|
+
stack_name_roger = "ecs-task-roger-qa-#{get_deploy_id}"
|
1322
|
+
git_checkout_version('roger', @projects["roger"]['revision'])
|
1323
|
+
stack_body = File.read('projects/roger/deploy/task.yml')
|
1324
|
+
parameters = [
|
1325
|
+
{
|
1326
|
+
parameter_key: "Environment",
|
1327
|
+
parameter_value: "qa"
|
1328
|
+
},
|
1329
|
+
{
|
1330
|
+
parameter_key: "ReleaseVersion",
|
1331
|
+
parameter_value: @projects["roger"]['revision']
|
1332
|
+
},
|
1333
|
+
{
|
1334
|
+
parameter_key: "ECSClusterName",
|
1335
|
+
parameter_value: get_ecs_cluster_name
|
1336
|
+
},
|
1337
|
+
{
|
1338
|
+
parameter_key: "TaskDesiredCount",
|
1339
|
+
parameter_value: '1'
|
1340
|
+
}
|
1341
|
+
]
|
1342
|
+
if stack_exists?(stack_name_roger)
|
1343
|
+
cur_version = get_currently_deployed_version(stack_name_roger)
|
1344
|
+
update_stack(stack_name_roger, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["roger"]['revision'])
|
1345
|
+
else
|
1346
|
+
create_stack(stack_name_roger, stack_body, parameters, @tags, @cf_role)
|
1347
|
+
end
|
1348
|
+
end
|
1349
|
+
|
1350
|
+
def create_hutch_stack()
|
1351
|
+
wait_for_artifact('prima-artifacts-encrypted', "microservices/hutch/#{@projects["hutch"]['revision']}-#{get_deploy_id[0..7]}-qa.tar.gz")
|
1352
|
+
wait_for_stack_ready(get_stack_name("starsky")) unless stack_ready?(get_stack_name("starsky"))
|
1353
|
+
|
1354
|
+
stack_name_hutch = get_stack_name("hutch")
|
1355
|
+
git_checkout_version('hutch', @projects["hutch"]['revision'])
|
1356
|
+
stack_body = File.read('projects/hutch/deploy/task.yml')
|
1357
|
+
parameters = [
|
1358
|
+
{
|
1359
|
+
parameter_key: "Environment",
|
1360
|
+
parameter_value: "qa"
|
1361
|
+
},
|
1362
|
+
{
|
1363
|
+
parameter_key: "ReleaseVersion",
|
1364
|
+
parameter_value: "#{@projects["hutch"]['revision']}-#{get_deploy_id[0..7]}"
|
1365
|
+
},
|
1366
|
+
{
|
1367
|
+
parameter_key: "ALBShortName",
|
1368
|
+
parameter_value: "hutch-qa-#{get_deploy_id}"[0..27]
|
1369
|
+
},
|
1370
|
+
{
|
1371
|
+
parameter_key: "ECSClusterName",
|
1372
|
+
parameter_value: get_ecs_cluster_name
|
1373
|
+
},
|
1374
|
+
{
|
1375
|
+
parameter_key: "EnvHash",
|
1376
|
+
parameter_value: get_deploy_id
|
1377
|
+
},
|
1378
|
+
{
|
1379
|
+
parameter_key: "HostnamePattern",
|
1380
|
+
parameter_value: "hutch-#{get_deploy_id}.qa.colaster.com"
|
1381
|
+
},
|
1382
|
+
{
|
1383
|
+
parameter_key: "HostnamePatternPriority",
|
1384
|
+
parameter_value: (hostname_pattern_priority.to_i + 254).to_s
|
1385
|
+
},
|
1386
|
+
{
|
1387
|
+
parameter_key: "ApiUrl",
|
1388
|
+
parameter_value: "https://#{get_route53_hostname('maia-intermediari')}"
|
1389
|
+
}
|
1390
|
+
]
|
1391
|
+
if stack_exists?(stack_name_hutch)
|
1392
|
+
cur_version = get_currently_deployed_version(stack_name_hutch)
|
1393
|
+
update_stack(stack_name_hutch, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["hutch"]['revision'])
|
1394
|
+
else
|
1395
|
+
create_stack(stack_name_hutch, stack_body, parameters, @tags, @cf_role)
|
1396
|
+
end
|
1397
|
+
end
|
1398
|
+
|
1399
|
+
def create_maia_stack()
|
1400
|
+
wait_for_artifact('prima-artifacts-encrypted', "microservices/maia/#{@projects["maia"]['revision']}-qa.tar.gz")
|
1401
|
+
stack_name_maia = get_stack_name("maia")
|
1402
|
+
git_checkout_version('maia', @projects["maia"]['revision'])
|
1403
|
+
stack_body = File.read('projects/maia/deploy/task.yml')
|
1404
|
+
parameters = [
|
1405
|
+
{
|
1406
|
+
parameter_key: "Environment",
|
1407
|
+
parameter_value: "qa"
|
1408
|
+
},
|
1409
|
+
{
|
1410
|
+
parameter_key: "ReleaseVersion",
|
1411
|
+
parameter_value: "#{@projects["maia"]['revision']}"
|
1412
|
+
},
|
1413
|
+
{
|
1414
|
+
parameter_key: "ALBShortName",
|
1415
|
+
parameter_value: "maia-qa-#{get_deploy_id}"[0..15]
|
1416
|
+
},
|
1417
|
+
{
|
1418
|
+
parameter_key: "ECSClusterName",
|
1419
|
+
parameter_value: get_ecs_cluster_name
|
1420
|
+
},
|
1421
|
+
{
|
1422
|
+
parameter_key: "EnvHash",
|
1423
|
+
parameter_value: get_deploy_id
|
1424
|
+
},
|
1425
|
+
{
|
1426
|
+
parameter_key: "HostnamePatternPublic",
|
1427
|
+
parameter_value: "api*-#{get_deploy_id}.qa.colaster.com"
|
1428
|
+
},
|
1429
|
+
{
|
1430
|
+
parameter_key: "HostnamePatternPriority",
|
1431
|
+
parameter_value: (hostname_pattern_priority.to_i + 128).to_s
|
1432
|
+
},
|
1433
|
+
{
|
1434
|
+
parameter_key: "ProxyHostnameIntermediari",
|
1435
|
+
parameter_value: "api-intermediari-#{get_deploy_id}.qa.colaster.com"
|
1436
|
+
},
|
1437
|
+
{
|
1438
|
+
parameter_key: "ProxyHostnameApp",
|
1439
|
+
parameter_value: "api-#{get_deploy_id}.qa.colaster.com"
|
1440
|
+
}
|
1441
|
+
]
|
1442
|
+
if stack_exists?(stack_name_maia)
|
1443
|
+
cur_version = get_currently_deployed_version(stack_name_maia)
|
1444
|
+
update_stack(stack_name_maia, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["maia"]['revision'])
|
1445
|
+
else
|
1446
|
+
create_stack(stack_name_maia, stack_body, parameters, @tags, @cf_role)
|
1447
|
+
end
|
1448
|
+
end
|
1449
|
+
|
1450
|
+
def create_vianello_stack()
|
1451
|
+
if deploy_vianello_or_domus?
|
1452
|
+
wait_for_artifact('prima-artifacts-encrypted', "microservices/vianello/#{@projects["vianello"]['revision']}-qa.tar.gz")
|
1453
|
+
stack_name_vianello = "ecs-task-vianello-qa-#{get_deploy_id}"
|
1454
|
+
git_checkout_version('vianello', @projects["vianello"]['revision'])
|
1455
|
+
stack_body = File.read('projects/vianello/deploy/task.yml')
|
1456
|
+
parameters = [
|
1457
|
+
{
|
1458
|
+
parameter_key: "Environment",
|
1459
|
+
parameter_value: "qa"
|
1460
|
+
},
|
1461
|
+
{
|
1462
|
+
parameter_key: "ReleaseVersion",
|
1463
|
+
parameter_value: @projects["vianello"]['revision']
|
1464
|
+
},
|
1465
|
+
{
|
1466
|
+
parameter_key: "ECSClusterName",
|
1467
|
+
parameter_value: get_ecs_cluster_name
|
1468
|
+
},
|
1469
|
+
{
|
1470
|
+
parameter_key: "TaskDesiredCount",
|
1471
|
+
parameter_value: '1'
|
1472
|
+
},
|
1473
|
+
{
|
1474
|
+
parameter_key: "HostnamePattern",
|
1475
|
+
parameter_value: "vianello-#{get_deploy_id}.qa.colaster.com"
|
1476
|
+
},
|
1477
|
+
{
|
1478
|
+
parameter_key: "HostnamePatternPriority",
|
1479
|
+
parameter_value: (hostname_pattern_priority.to_i + 254).to_s
|
1480
|
+
},
|
1481
|
+
{
|
1482
|
+
parameter_key: "ECSClusterName",
|
1483
|
+
parameter_value: get_ecs_cluster_name
|
1484
|
+
},
|
1485
|
+
{
|
1486
|
+
parameter_key: "ALBShortName",
|
1487
|
+
parameter_value: "vianello-qa-#{get_deploy_id}"[0..27]
|
1488
|
+
},
|
1489
|
+
{
|
1490
|
+
parameter_key: "EnvHash",
|
1491
|
+
parameter_value: get_deploy_id
|
1492
|
+
}
|
1493
|
+
]
|
1494
|
+
if stack_exists?(stack_name_vianello)
|
1495
|
+
cur_version = get_currently_deployed_version(stack_name_vianello)
|
1496
|
+
update_stack(stack_name_vianello, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["vianello"]['revision'])
|
1497
|
+
else
|
1498
|
+
create_stack(stack_name_vianello, stack_body, parameters, @tags, @cf_role)
|
1499
|
+
end
|
1500
|
+
else
|
1501
|
+
true
|
1502
|
+
end
|
1503
|
+
end
|
1504
|
+
|
1505
|
+
def create_domus_stack()
|
1506
|
+
if deploy_vianello_or_domus?
|
1507
|
+
wait_for_artifact('prima-artifacts-encrypted', "microservices/domus/#{@projects["domus"]['revision']}-#{get_deploy_id[0..7]}-qa.tar.gz")
|
1508
|
+
wait_for_stack_ready(get_stack_name("vianello")) unless stack_ready?(get_stack_name("vianello"))
|
1509
|
+
|
1510
|
+
stack_name_domus = get_stack_name("domus")
|
1511
|
+
git_checkout_version('domus', @projects["domus"]['revision'])
|
1512
|
+
stack_body = File.read('projects/domus/deploy/task.yml')
|
1513
|
+
parameters = [
|
1514
|
+
{
|
1515
|
+
parameter_key: "Environment",
|
1516
|
+
parameter_value: "qa"
|
1517
|
+
},
|
1518
|
+
{
|
1519
|
+
parameter_key: "ReleaseVersion",
|
1520
|
+
parameter_value: "#{@projects["domus"]['revision']}-#{get_deploy_id[0..7]}"
|
1521
|
+
},
|
1522
|
+
{
|
1523
|
+
parameter_key: "ALBShortName",
|
1524
|
+
parameter_value: "domus-qa-#{get_deploy_id}"[0..27]
|
1525
|
+
},
|
1526
|
+
{
|
1527
|
+
parameter_key: "ECSClusterName",
|
1528
|
+
parameter_value: get_ecs_cluster_name
|
1529
|
+
},
|
1530
|
+
{
|
1531
|
+
parameter_key: "EnvHash",
|
1532
|
+
parameter_value: get_deploy_id
|
1533
|
+
},
|
1534
|
+
{
|
1535
|
+
parameter_key: "HostnamePattern",
|
1536
|
+
parameter_value: "domus-#{get_deploy_id}.qa.colaster.com"
|
1537
|
+
},
|
1538
|
+
{
|
1539
|
+
parameter_key: "HostnamePatternPriority",
|
1540
|
+
parameter_value: (hostname_pattern_priority.to_i + 254).to_s
|
1541
|
+
},
|
1542
|
+
{
|
1543
|
+
parameter_key: "ApiUrl",
|
1544
|
+
parameter_value: "https://#{get_route53_hostname('vianello')}"
|
1545
|
+
}
|
1546
|
+
]
|
1547
|
+
if stack_exists?(stack_name_domus)
|
1548
|
+
cur_version = get_currently_deployed_version(stack_name_domus)
|
1549
|
+
update_stack(stack_name_domus, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["domus"]['revision'])
|
1550
|
+
else
|
1551
|
+
create_stack(stack_name_domus, stack_body, parameters, @tags, @cf_role)
|
1552
|
+
end
|
1553
|
+
else
|
1554
|
+
true
|
1555
|
+
end
|
1556
|
+
end
|
1557
|
+
|
1558
|
+
def create_toretto_stack()
|
1559
|
+
if deploy_toretto?
|
1560
|
+
wait_for_artifact('prima-artifacts-encrypted', "microservices/toretto/#{@projects["toretto"]['revision']}-qa.tar.gz")
|
1561
|
+
|
1562
|
+
git_checkout_version('toretto', @projects["toretto"]['revision'])
|
1563
|
+
stack_name_toretto = get_stack_name("toretto")
|
1564
|
+
stack_body = IO.read('projects/toretto/deploy/task.yml')
|
1565
|
+
parameters = [
|
1566
|
+
{
|
1567
|
+
parameter_key: "Environment",
|
1568
|
+
parameter_value: "qa"
|
1569
|
+
},
|
1570
|
+
{
|
1571
|
+
parameter_key: "ReleaseVersion",
|
1572
|
+
parameter_value: "#{@projects["toretto"]['revision']}"
|
1573
|
+
},
|
1574
|
+
{
|
1575
|
+
parameter_key: "TaskDesiredCount",
|
1576
|
+
parameter_value: "1"
|
1577
|
+
},
|
1578
|
+
{
|
1579
|
+
parameter_key: "ECSClusterName",
|
1580
|
+
parameter_value: get_ecs_cluster_name
|
1581
|
+
},
|
1582
|
+
{
|
1583
|
+
parameter_key: "ALBShortName",
|
1584
|
+
parameter_value: "toretto-api-qa-#{get_deploy_id}"[0..27]
|
1585
|
+
},
|
1586
|
+
{
|
1587
|
+
parameter_key: "EnvHash",
|
1588
|
+
parameter_value: get_deploy_id
|
1589
|
+
},
|
1590
|
+
{
|
1591
|
+
parameter_key: "HostnamePattern",
|
1592
|
+
parameter_value: "carrozzerie-api-#{get_deploy_id}.qa.colaster.com"
|
1593
|
+
},
|
1594
|
+
{
|
1595
|
+
parameter_key: "HostnamePatternPriority",
|
1596
|
+
parameter_value: (hostname_pattern_priority.to_i + 79).to_s
|
1597
|
+
}
|
1598
|
+
]
|
1599
|
+
if stack_exists?(stack_name_toretto)
|
1600
|
+
cur_version = get_currently_deployed_version(stack_name_toretto)
|
1601
|
+
unless cur_version.include?(@projects["toretto"]['revision'])
|
1602
|
+
delete_stack(stack_name_toretto)
|
1603
|
+
wait_for_stack_removal(stack_name_toretto)
|
1604
|
+
create_stack(stack_name_toretto, stack_body, parameters, @tags, @cf_role)
|
1605
|
+
end
|
1606
|
+
else
|
1607
|
+
create_stack(stack_name_toretto, stack_body, parameters, @tags, @cf_role)
|
1608
|
+
end
|
1609
|
+
|
1610
|
+
wait_for_artifact('prima-artifacts-encrypted', "microservices/toretto/fe-#{@projects["toretto"]['revision']}-#{get_deploy_id[0..7]}-qa.tar.gz")
|
1611
|
+
|
1612
|
+
stack_name_toretto_fe = get_stack_name("toretto-fe")
|
1613
|
+
git_checkout_version('toretto', @projects["toretto"]['revision'])
|
1614
|
+
stack_body = File.read('projects/toretto/deploy/task-fe.yml')
|
1615
|
+
parameters = [
|
1616
|
+
{
|
1617
|
+
parameter_key: "Environment",
|
1618
|
+
parameter_value: "qa"
|
1619
|
+
},
|
1620
|
+
{
|
1621
|
+
parameter_key: "ReleaseVersion",
|
1622
|
+
parameter_value: "#{@projects["toretto"]['revision']}-#{get_deploy_id[0..7]}"
|
1623
|
+
},
|
1624
|
+
{
|
1625
|
+
parameter_key: "ALBShortName",
|
1626
|
+
parameter_value: "toretto-fe-qa-#{get_deploy_id}"[0..27]
|
1627
|
+
},
|
1628
|
+
{
|
1629
|
+
parameter_key: "ECSClusterName",
|
1630
|
+
parameter_value: get_ecs_cluster_name
|
1631
|
+
},
|
1632
|
+
{
|
1633
|
+
parameter_key: "EnvHash",
|
1634
|
+
parameter_value: get_deploy_id
|
1635
|
+
},
|
1636
|
+
{
|
1637
|
+
parameter_key: "HostnamePattern",
|
1638
|
+
parameter_value: "carrozzerie-#{get_deploy_id}.qa.colaster.com"
|
1639
|
+
},
|
1640
|
+
{
|
1641
|
+
parameter_key: "HostnamePatternPriority",
|
1642
|
+
parameter_value: (hostname_pattern_priority.to_i + 254).to_s
|
1643
|
+
},
|
1644
|
+
{
|
1645
|
+
parameter_key: "ApiUrl",
|
1646
|
+
parameter_value: "https://#{get_route53_hostname('maia-intermediari')}"
|
1647
|
+
}
|
1648
|
+
]
|
1649
|
+
if stack_exists?(stack_name_toretto_fe)
|
1650
|
+
cur_version = get_currently_deployed_version(stack_name_toretto_fe)
|
1651
|
+
update_stack(stack_name_toretto_fe, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["toretto"]['revision'])
|
1652
|
+
else
|
1653
|
+
create_stack(stack_name_toretto_fe, stack_body, parameters, @tags, @cf_role)
|
1654
|
+
end
|
1655
|
+
else
|
1656
|
+
true
|
1657
|
+
end
|
1658
|
+
end
|
1659
|
+
|
1660
|
+
def create_rogoreport_stack()
|
1661
|
+
true
|
1662
|
+
end
|
1663
|
+
|
1664
|
+
def complete_qa_setup!()
|
1665
|
+
wait_for_stack_ready(get_stack_name("web")) unless stack_ready?(get_stack_name("web"))
|
1666
|
+
wait_for_stack_ready(get_stack_name("consumer")) unless stack_ready?(get_stack_name("consumer"))
|
1667
|
+
wait_for_stack_ready(get_stack_name("worker-ermes")) unless stack_ready?(get_stack_name("worker-ermes"))
|
1668
|
+
wait_for_stack_ready(get_stack_name("ermes")) unless stack_ready?(get_stack_name("ermes"))
|
1669
|
+
wait_for_stack_ready(get_stack_name("peano")) unless stack_ready?(get_stack_name("peano"))
|
1670
|
+
wait_for_stack_ready(get_stack_name("legion")) unless stack_ready?(get_stack_name("legion"))
|
1671
|
+
wait_for_stack_ready(get_stack_name("borat")) unless stack_ready?(get_stack_name("borat"))
|
1672
|
+
wait_for_stack_ready(get_stack_name("activia")) unless stack_ready?(get_stack_name("activia"))
|
1673
|
+
wait_for_stack_ready(get_stack_name("maia")) unless stack_ready?(get_stack_name("maia"))
|
1674
|
+
wait_for_stack_ready(get_stack_name("crash")) unless stack_ready?(get_stack_name("crash"))
|
1675
|
+
wait_for_stack_ready(get_stack_name("hutch")) unless stack_ready?(get_stack_name("hutch"))
|
1676
|
+
if deploy_vianello_or_domus?
|
1677
|
+
wait_for_stack_ready(get_stack_name("vianello")) unless stack_ready?(get_stack_name("vianello"))
|
1678
|
+
wait_for_stack_ready(get_stack_name("domus")) unless stack_ready?(get_stack_name("domus"))
|
1679
|
+
end
|
1680
|
+
if deploy_toretto?
|
1681
|
+
wait_for_stack_ready(get_stack_name("toretto")) unless stack_ready?(get_stack_name("toretto"))
|
1682
|
+
wait_for_stack_ready(get_stack_name("toretto-fe")) unless stack_ready?(get_stack_name("toretto-fe"))
|
1683
|
+
end
|
1684
|
+
|
1685
|
+
update_service_defaults(get_stack_name("web"))
|
1686
|
+
update_service_defaults(get_stack_name("consumer-api"))
|
1687
|
+
update_service_defaults(get_stack_name("urania"))
|
1688
|
+
update_service_defaults(get_stack_name("worker-ermes"))
|
1689
|
+
update_service_defaults(get_stack_name("ermes"))
|
1690
|
+
update_service_defaults(get_stack_name("bburago"))
|
1691
|
+
update_service_defaults(get_stack_name("hal9000"))
|
1692
|
+
update_service_defaults(get_stack_name("fidaty"))
|
1693
|
+
update_service_defaults(get_stack_name("peano"))
|
1694
|
+
# update_service_defaults(get_stack_name("legion")) TODO UNCOMMENT
|
1695
|
+
update_service_defaults(get_stack_name("assange"))
|
1696
|
+
update_service_defaults(get_stack_name("borat"))
|
1697
|
+
update_service_defaults(get_stack_name("activia"))
|
1698
|
+
update_service_defaults(get_stack_name("skynet"))
|
1699
|
+
update_service_defaults(get_stack_name("leftorium"))
|
1700
|
+
update_service_defaults(get_stack_name("rachele"))
|
1701
|
+
update_service_defaults(get_stack_name("maia"))
|
1702
|
+
update_service_defaults(get_stack_name("starsky"))
|
1703
|
+
update_service_defaults(get_stack_name("hutch"))
|
1704
|
+
update_service_defaults(get_stack_name("crash"))
|
1705
|
+
if deploy_vianello_or_domus?
|
1706
|
+
update_service_defaults(get_stack_name("vianello"))
|
1707
|
+
update_service_defaults(get_stack_name("domus"))
|
1708
|
+
end
|
1709
|
+
if deploy_toretto?
|
1710
|
+
update_service_defaults(get_stack_name("toretto"))
|
1711
|
+
update_service_defaults(get_stack_name("toretto-fe"))
|
1712
|
+
end
|
1713
|
+
|
1714
|
+
activia_hostname = get_route53_hostname("activia")
|
1715
|
+
assange_hostname = get_route53_hostname("assange")
|
1716
|
+
bburago_hostname = get_route53_hostname("bburago")
|
1717
|
+
borat_hostname = get_route53_hostname("borat")
|
1718
|
+
ermes_hostname = get_route53_hostname("ermes")
|
1719
|
+
fidaty_hostname = get_route53_hostname("fidaty")
|
1720
|
+
hal9000_hostname = get_route53_hostname("hal9000")
|
1721
|
+
prima_hostname = get_route53_hostname("web")
|
1722
|
+
peano_hostname = get_route53_hostname("peano")
|
1723
|
+
skynet_hostname = get_route53_hostname("skynet")
|
1724
|
+
urania_hostname = get_route53_hostname("urania")
|
1725
|
+
roger_hostname = get_route53_hostname("roger")
|
1726
|
+
leftorium_hostname = get_route53_hostname("leftorium")
|
1727
|
+
rachele_hostname = get_route53_hostname("rachele")
|
1728
|
+
maia_app_hostname = get_route53_hostname("maia-app")
|
1729
|
+
maia_intermediari_hostname = get_route53_hostname("maia-intermediari")
|
1730
|
+
crash_hostname = get_route53_hostname("crash")
|
1731
|
+
starsky_hostname = get_route53_hostname("starsky")
|
1732
|
+
hutch_hostname = get_route53_hostname("hutch")
|
1733
|
+
legion_hostname = get_route53_hostname("legion")
|
1734
|
+
vianello_hostname = get_route53_hostname("vianello")
|
1735
|
+
domus_hostname = get_route53_hostname("domus")
|
1736
|
+
toretto_hostname = get_route53_hostname("toretto")
|
1737
|
+
toretto_fe_hostname = get_route53_hostname("toretto_fe")
|
1738
|
+
|
1739
|
+
#launch_mimo(get_deploy_id)
|
1740
|
+
|
1741
|
+
projects_text = "
|
1742
|
+
> Prima url: https://#{prima_hostname}
|
1743
|
+
> Backoffice (Borat) url: https://#{borat_hostname}
|
1744
|
+
> Urania url: http://#{urania_hostname}:81
|
1745
|
+
> Bburago url: http://#{bburago_hostname}:83
|
1746
|
+
> Ermes url: http://#{ermes_hostname}:10002
|
1747
|
+
> Hal9000 url: http://#{hal9000_hostname}:10031
|
1748
|
+
> Fidaty url: http://#{fidaty_hostname}:10021
|
1749
|
+
> Peano url: http://#{peano_hostname}:10039
|
1750
|
+
> Assange url: https://#{assange_hostname}
|
1751
|
+
> Activia url: http://#{activia_hostname}:10041
|
1752
|
+
> Skynet url: http://#{skynet_hostname}:8050
|
1753
|
+
> Roger url: http://#{roger_hostname}:10051
|
1754
|
+
> Leftorium url: http://#{leftorium_hostname}:10061
|
1755
|
+
> Rachele url: http://#{rachele_hostname}:10040
|
1756
|
+
> Maia App url: https://#{maia_app_hostname}
|
1757
|
+
> Maia Intermediari url: https://#{maia_intermediari_hostname}
|
1758
|
+
> Legion url: http://#{legion_hostname}:8051
|
1759
|
+
> Crash url: https://#{crash_hostname}
|
1760
|
+
> Starsky url: https://#{starsky_hostname}
|
1761
|
+
> Hutch url: https://#{hutch_hostname}"
|
1762
|
+
projects_text.concat "
|
1763
|
+
> Vianello url: https://#{vianello_hostname}
|
1764
|
+
> Domus url: https://#{domus_hostname}" if deploy_vianello_or_domus?
|
1765
|
+
projects_text.concat "
|
1766
|
+
> Toretto url: https://#{toretto_fe_hostname}
|
1767
|
+
> Toretto Backend url: https://#{toretto_hostname}" if deploy_toretto?
|
1768
|
+
projects_text.concat "
|
1769
|
+
> RabbitMQ url: http://#{get_ec2_ip_address}:15672
|
1770
|
+
> Elasticsearch url: http://#{get_ec2_ip_address}:9200
|
1771
|
+
> Git branch: #{@git_branch}
|
1772
|
+
> SSH connection: ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no githubUsername@#{get_ec2_ip_address}\n"
|
1773
|
+
output projects_text.cyan
|
1774
|
+
output "Deploy effettuato, everything is awesome!\n".green
|
1775
|
+
|
1776
|
+
if @projects['prima']['name'] != 'master' then
|
1777
|
+
output "Lancio il batch job per la visual regression..."
|
1778
|
+
launch_bocelli_test(prima_hostname)
|
1779
|
+
output "Visual regression lanciata con successo!"
|
1780
|
+
|
1781
|
+
output "Lancio i test con Lighthouse..."
|
1782
|
+
launch_lighthouse_test(prima_hostname, "mobile")
|
1783
|
+
launch_lighthouse_test(prima_hostname, "desktop")
|
1784
|
+
output "Test con Lighthouse lanciati con successo..."
|
1785
|
+
end
|
1786
|
+
|
1787
|
+
qainit_write_output(projects_text, 'Indirizzi scritti su ')
|
1788
|
+
end
|
1789
|
+
|
1790
|
+
def get_route53_hostname(project)
|
1791
|
+
case
|
1792
|
+
when project.include?('web')
|
1793
|
+
host = "www-#{get_deploy_id}.qa.colaster.com"
|
1794
|
+
when project.include?('urania')
|
1795
|
+
host = "urania-#{get_deploy_id}.qa.colaster.com"
|
1796
|
+
when project.include?('bburago')
|
1797
|
+
host = "bburago-#{get_deploy_id}.qa.colaster.com"
|
1798
|
+
when project.include?('hal9000')
|
1799
|
+
host = "hal9000-#{get_deploy_id}.qa.colaster.com"
|
1800
|
+
when project.include?('fidaty')
|
1801
|
+
host = "fidaty-#{get_deploy_id}.qa.colaster.com"
|
1802
|
+
when project.include?('peano')
|
1803
|
+
host = "peano-#{get_deploy_id}.qa.colaster.com"
|
1804
|
+
when project.include?('assange')
|
1805
|
+
host = "assange-#{get_deploy_id}.qa.colaster.com"
|
1806
|
+
when project.include?('borat')
|
1807
|
+
host = "backoffice-#{get_deploy_id}.qa.colaster.com"
|
1808
|
+
when project.include?('crash')
|
1809
|
+
host = "crash-#{get_deploy_id}.qa.colaster.com"
|
1810
|
+
when project.include?('ermes')
|
1811
|
+
host = "ermes-#{get_deploy_id}.qa.colaster.com"
|
1812
|
+
when project.include?('activia')
|
1813
|
+
host = "activia-#{get_deploy_id}.qa.colaster.com"
|
1814
|
+
when project.include?('skynet')
|
1815
|
+
host = "skynet-#{get_deploy_id}.qa.colaster.com"
|
1816
|
+
when project.include?('roger')
|
1817
|
+
host = "roger-#{get_deploy_id}.qa.colaster.com"
|
1818
|
+
when project.include?('leftorium')
|
1819
|
+
host = "leftorium-#{get_deploy_id}.qa.colaster.com"
|
1820
|
+
when project.include?('rachele')
|
1821
|
+
host = "rachele-#{get_deploy_id}.qa.colaster.com"
|
1822
|
+
when project.include?('starsky')
|
1823
|
+
host = "starsky-#{get_deploy_id}.qa.colaster.com"
|
1824
|
+
when project.include?('hutch')
|
1825
|
+
host = "hutch-#{get_deploy_id}.qa.colaster.com"
|
1826
|
+
when project.include?('maia-app')
|
1827
|
+
host = "api-#{get_deploy_id}.qa.colaster.com"
|
1828
|
+
when project.include?('legion')
|
1829
|
+
host = "legion-#{get_deploy_id}.qa.colaster.com"
|
1830
|
+
when project.include?('maia-intermediari')
|
1831
|
+
host = "api-intermediari-#{get_deploy_id}.qa.colaster.com"
|
1832
|
+
when project.include?('vianello')
|
1833
|
+
host = "vianello-#{get_deploy_id}.qa.colaster.com"
|
1834
|
+
when project.include?('domus')
|
1835
|
+
host = "domus-#{get_deploy_id}.qa.colaster.com"
|
1836
|
+
when project.include?('toretto_fe')
|
1837
|
+
host = "carrozzerie-#{get_deploy_id}.qa.colaster.com"
|
1838
|
+
when project.include?('toretto')
|
1839
|
+
host = "carrozzerie-api-#{get_deploy_id}.qa.colaster.com"
|
1840
|
+
end
|
1841
|
+
host
|
1842
|
+
end
|
1843
|
+
|
1844
|
+
def get_ec2_ip_address()
|
1845
|
+
if @ec2_ip_address
|
1846
|
+
@ec2_ip_address
|
1847
|
+
else
|
1848
|
+
resp = describe_stack_resource(get_asg_stack_name, 'ECSAutoScalingGroup')
|
1849
|
+
resp = describe_auto_scaling_groups([resp.stack_resource_detail.physical_resource_id], 1)
|
1850
|
+
instance_id = resp.auto_scaling_groups[0].instances[0].instance_id
|
1851
|
+
resp = describe_instances([instance_id])
|
1852
|
+
@ec2_ip_address = resp.reservations[0].instances[0].private_ip_address
|
1853
|
+
@ec2_ip_address
|
1854
|
+
end
|
1855
|
+
end
|
1856
|
+
|
1857
|
+
def get_alb_host(stack_name)
|
1858
|
+
case
|
1859
|
+
when stack_name.include?('web')
|
1860
|
+
logical_resource_id = 'EcsApplicationLoadBalancerPublic'
|
1861
|
+
when stack_name.include?('urania')
|
1862
|
+
logical_resource_id = 'EcsApplicationLoadBalancerInternal'
|
1863
|
+
when stack_name.include?('backoffice')
|
1864
|
+
logical_resource_id = 'EcsApplicationLoadBalancerPublic'
|
1865
|
+
when stack_name.include?('bburago')
|
1866
|
+
logical_resource_id = 'EcsApplicationLoadBalancerInternal'
|
1867
|
+
when stack_name.include?('hal9000')
|
1868
|
+
logical_resource_id = 'EcsApplicationLoadBalancerInternal'
|
1869
|
+
when stack_name.include?('fidaty')
|
1870
|
+
logical_resource_id = 'EcsApplicationLoadBalancerInternal'
|
1871
|
+
when stack_name.include?('activia')
|
1872
|
+
logical_resource_id = 'EcsApplicationLoadBalancerInternal'
|
1873
|
+
when stack_name.include?('skynet')
|
1874
|
+
logical_resource_id = 'EcsApplicationLoadBalancerInternal'
|
1875
|
+
when stack_name.include?('roger')
|
1876
|
+
logical_resource_id = 'EcsApplicationLoadBalancerInternal'
|
1877
|
+
when stack_name.include?('alb-http-public')
|
1878
|
+
logical_resource_id = 'EcsApplicationLoadBalancerPublic'
|
1879
|
+
when stack_name.include?('alb-ws-public')
|
1880
|
+
logical_resource_id = 'EcsApplicationLoadBalancerPublic'
|
1881
|
+
when stack_name.include?('peano')
|
1882
|
+
logical_resource_id = 'EcsApplicationLoadBalancerInternal'
|
1883
|
+
when stack_name.include?('leftorium')
|
1884
|
+
logical_resource_id = 'EcsApplicationLoadBalancerInternal'
|
1885
|
+
when stack_name.include?('assange')
|
1886
|
+
logical_resource_id = 'EcsApplicationLoadBalancerPublic'
|
1887
|
+
when stack_name.include?('borat')
|
1888
|
+
logical_resource_id = 'EcsApplicationLoadBalancerPublic'
|
1889
|
+
when stack_name.include?('crash')
|
1890
|
+
logical_resource_id = 'EcsApplicationLoadBalancerPublic'
|
1891
|
+
when stack_name.include?('rachele')
|
1892
|
+
logical_resource_id = 'EcsApplicationLoadBalancerInternal'
|
1893
|
+
when stack_name.include?('starsky')
|
1894
|
+
logical_resource_id = 'EcsApplicationLoadBalancerPublic'
|
1895
|
+
when stack_name.include?('hutch')
|
1896
|
+
logical_resource_id = 'EcsApplicationLoadBalancerPublic'
|
1897
|
+
when stack_name.include?('maia')
|
1898
|
+
logical_resource_id = 'EcsApplicationLoadBalancerPublic'
|
1899
|
+
when stack_name.include?('legion')
|
1900
|
+
logical_resource_id = 'EcsApplicationLoadBalancerInternal'
|
1901
|
+
when stack_name.include?('vianello')
|
1902
|
+
logical_resource_id = 'EcsApplicationLoadBalancerInternal'
|
1903
|
+
when stack_name.include?('domus')
|
1904
|
+
logical_resource_id = 'EcsApplicationLoadBalancerPublic'
|
1905
|
+
when stack_name.include?('toretto_fe')
|
1906
|
+
logical_resource_id = 'EcsApplicationLoadBalancerPublic'
|
1907
|
+
when stack_name.include?('toretto')
|
1908
|
+
logical_resource_id = 'EcsApplicationLoadBalancerPublic'
|
1909
|
+
end
|
1910
|
+
resp = describe_stack_resource(stack_name, logical_resource_id)
|
1911
|
+
resp = describe_load_balancers([resp.stack_resource_detail.physical_resource_id])
|
1912
|
+
resp.load_balancers[0].dns_name
|
1913
|
+
end
|
1914
|
+
|
1915
|
+
def update_service_defaults(stack_name)
|
1916
|
+
case
|
1917
|
+
when stack_name.include?('web')
|
1918
|
+
logical_resource_id = 'ECSServiceWebQA'
|
1919
|
+
when stack_name.include?('consumer')
|
1920
|
+
logical_resource_id = 'ECSServiceConsumerApiQa'
|
1921
|
+
when stack_name.include?('urania')
|
1922
|
+
logical_resource_id = 'ECSServiceUraniaQA'
|
1923
|
+
when stack_name.include?('backoffice')
|
1924
|
+
logical_resource_id = 'ECSServiceBackoffice'
|
1925
|
+
when stack_name.include?('worker-ermes')
|
1926
|
+
logical_resource_id = 'ECSServiceErmesWorker'
|
1927
|
+
when stack_name.include?('ermes')
|
1928
|
+
logical_resource_id = 'ECSServiceErmesQA'
|
1929
|
+
when stack_name.include?('bburago')
|
1930
|
+
logical_resource_id = 'ECSServiceBburagoQA'
|
1931
|
+
when stack_name.include?('hal9000')
|
1932
|
+
logical_resource_id = 'ECSServiceHal9000QA'
|
1933
|
+
when stack_name.include?('fidaty')
|
1934
|
+
logical_resource_id = 'ECSServiceFidatyQA'
|
1935
|
+
when stack_name.include?('skynet')
|
1936
|
+
logical_resource_id = 'ECSServiceSkynetQA'
|
1937
|
+
when stack_name.include?('roger')
|
1938
|
+
logical_resource_id = 'ECSServiceRogerQA'
|
1939
|
+
when stack_name.include?('activia')
|
1940
|
+
logical_resource_id = 'ECSServiceActiviaQA'
|
1941
|
+
when stack_name.include?('peano')
|
1942
|
+
logical_resource_id = 'ECSServicePeanoQA'
|
1943
|
+
when stack_name.include?('assange')
|
1944
|
+
logical_resource_id = 'ECSServiceAssangeQA'
|
1945
|
+
when stack_name.include?('borat')
|
1946
|
+
logical_resource_id = 'ECSServiceBorat'
|
1947
|
+
when stack_name.include?('leftorium')
|
1948
|
+
logical_resource_id = 'ECSServiceLeftoriumQA'
|
1949
|
+
when stack_name.include?('rachele')
|
1950
|
+
logical_resource_id = 'ECSServiceRacheleQA'
|
1951
|
+
when stack_name.include?('crash')
|
1952
|
+
logical_resource_id = 'ECSServiceCrashQA'
|
1953
|
+
when stack_name.include?('starsky')
|
1954
|
+
logical_resource_id = 'ECSServiceStarskyQA'
|
1955
|
+
when stack_name.include?('hutch')
|
1956
|
+
logical_resource_id = 'ECSServiceHutch'
|
1957
|
+
when stack_name.include?('maia')
|
1958
|
+
logical_resource_id = 'ECSServiceMaia'
|
1959
|
+
when stack_name.include?('legion')
|
1960
|
+
logical_resource_id = 'ECSServiceLegionQA'
|
1961
|
+
when stack_name.include?('vianello')
|
1962
|
+
logical_resource_id = 'ECSServiceVianelloQA'
|
1963
|
+
when stack_name.include?('domus')
|
1964
|
+
logical_resource_id = 'ECSServiceDomus'
|
1965
|
+
when stack_name.include?('toretto')
|
1966
|
+
logical_resource_id = 'ECSServiceTorettoQA'
|
1967
|
+
when stack_name.include?('toretto_fe')
|
1968
|
+
logical_resource_id = 'ECSServiceToretto'
|
1969
|
+
else
|
1970
|
+
raise "Service name non gestito per lo stack #{stack_name}"
|
1971
|
+
end
|
1972
|
+
resp = describe_stack_resource(stack_name, logical_resource_id)
|
1973
|
+
update_ecs_service(get_ecs_cluster_name, resp.stack_resource_detail.physical_resource_id, {minimum_healthy_percent: 0, maximum_percent: 100})
|
1974
|
+
end
|
1975
|
+
|
1976
|
+
def launch_lighthouse_test(url, device)
|
1977
|
+
@cloudflare.post("zones/1fb634f19c43dfb0162cc4cb91915da2/dns_records", {type: 'CNAME', name: "www-#{get_deploy_id}", content: url, proxied: true, ttl: 1}) unless get_lighthouse_dns()
|
1978
|
+
|
1979
|
+
@batch.submit_job({
|
1980
|
+
job_name: "lighthouse-#{device}-#{get_deploy_id}",
|
1981
|
+
job_queue: "tools-production",
|
1982
|
+
job_definition: describe_stack_resource('batch-job-lighthouse-production', 'JobDefinition').stack_resource_detail.physical_resource_id,
|
1983
|
+
container_overrides: {
|
1984
|
+
environment: [
|
1985
|
+
{
|
1986
|
+
name: "URL_TO_TEST",
|
1987
|
+
value: "https://www-#{get_deploy_id}.prima.it/?superprima"
|
1988
|
+
},
|
1989
|
+
{
|
1990
|
+
name: "DEVICE",
|
1991
|
+
value: device
|
1992
|
+
},
|
1993
|
+
{
|
1994
|
+
name: "BRANCH_NAME",
|
1995
|
+
value: @projects['prima']['name']
|
1996
|
+
},
|
1997
|
+
{
|
1998
|
+
name: "COMMITTER_EMAIL",
|
1999
|
+
value: @projects['prima']['committer']
|
2000
|
+
}
|
2001
|
+
]
|
2002
|
+
}
|
2003
|
+
})
|
2004
|
+
end
|
2005
|
+
|
2006
|
+
def get_lighthouse_dns()
|
2007
|
+
dns_records = @cloudflare.get("zones/1fb634f19c43dfb0162cc4cb91915da2/dns_records", {per_page: 100, type: 'CNAME', name: "www-#{get_deploy_id}.prima.it"})
|
2008
|
+
if dns_records.body[:result_info][:count] > 0
|
2009
|
+
return dns_records.body[:result][0][:id]
|
2010
|
+
end
|
2011
|
+
false
|
2012
|
+
end
|
2013
|
+
|
2014
|
+
def delete_lighthouse_dns()
|
2015
|
+
dns_id = get_lighthouse_dns()
|
2016
|
+
@cloudflare.delete("zones/1fb634f19c43dfb0162cc4cb91915da2/dns_records/#{dns_id}") if dns_id
|
2017
|
+
end
|
2018
|
+
|
2019
|
+
def launch_bocelli_test(url)
|
2020
|
+
@batch.submit_job({
|
2021
|
+
job_name: "bocelli-test-#{get_deploy_id}",
|
2022
|
+
job_queue: "tools-production",
|
2023
|
+
job_definition: describe_stack_resource('batch-job-bocelli-production', 'JobDefinition').stack_resource_detail.physical_resource_id,
|
2024
|
+
container_overrides: {
|
2025
|
+
environment: [
|
2026
|
+
{
|
2027
|
+
name: "BATCH_COMMAND",
|
2028
|
+
value: "test"
|
2029
|
+
},
|
2030
|
+
{
|
2031
|
+
name: "QA_HOSTNAME",
|
2032
|
+
value: url
|
2033
|
+
},
|
2034
|
+
{
|
2035
|
+
name: "BRANCH_NAME",
|
2036
|
+
value: @projects['prima']['name']
|
2037
|
+
},
|
2038
|
+
{
|
2039
|
+
name: "COMMITTER_EMAIL",
|
2040
|
+
value: @projects['prima']['committer']
|
2041
|
+
}
|
2042
|
+
]
|
2043
|
+
}
|
2044
|
+
})
|
2045
|
+
end
|
2046
|
+
|
2047
|
+
def deploy_vianello_or_domus?
|
2048
|
+
vianello_present = !@projects['vianello'].empty? && @projects['vianello'][:name] != 'master' && !@projects['vianello'][:default_branch]
|
2049
|
+
domus_present = !@projects['domus'].empty? && @projects['domus'][:name] != 'master' && !@projects['domus'][:default_branch]
|
2050
|
+
vianello_present || domus_present
|
2051
|
+
end
|
2052
|
+
|
2053
|
+
def deploy_toretto?
|
2054
|
+
toretto_present = !@projects['toretto'].empty? && @projects['toretto'][:name] != 'master' && !@projects['toretto'][:default_branch]
|
2055
|
+
crash_present = !@projects['crash'].empty? && @projects['crash'][:name] != 'master' && !@projects['crash'][:default_branch]
|
2056
|
+
toretto_present || crash_present
|
2057
|
+
end
|
2058
|
+
|
2059
|
+
def git_checkout_version(project, revision)
|
2060
|
+
Dir.chdir "projects/#{project}"
|
2061
|
+
exec_step "git checkout -- . && git checkout #{revision}"
|
2062
|
+
Dir.chdir "../../"
|
2063
|
+
end
|
2064
|
+
|
2065
|
+
def create_asg_stack(stack_name, tags = [])
|
2066
|
+
stack_body = IO.read('cloudformation/stacks/asg/ecs-asg-allinone.yml')
|
2067
|
+
parameters = [
|
2068
|
+
{
|
2069
|
+
parameter_key: "Environment",
|
2070
|
+
parameter_value: "qa"
|
2071
|
+
},
|
2072
|
+
{
|
2073
|
+
parameter_key: "InstanceType",
|
2074
|
+
parameter_value: "t3a.xlarge"
|
2075
|
+
},
|
2076
|
+
{
|
2077
|
+
parameter_key: "ECSClusterName",
|
2078
|
+
parameter_value: get_ecs_cluster_name
|
2079
|
+
},
|
2080
|
+
{
|
2081
|
+
parameter_key: "AMIID",
|
2082
|
+
parameter_value: @ami_id
|
2083
|
+
}
|
2084
|
+
]
|
2085
|
+
create_stack(stack_name, stack_body, parameters, tags, @cf_role)
|
2086
|
+
end
|
2087
|
+
|
2088
|
+
def create_cluster_stack(stack_name, tags = [])
|
2089
|
+
stack_body = IO.read('cloudformation/stacks/ecs-cluster.yml')
|
2090
|
+
create_stack(stack_name, stack_body, [], tags)
|
2091
|
+
end
|
2092
|
+
|
2093
|
+
def update_cluster_stack(stack_name, tags = [])
|
2094
|
+
stack_body = IO.read('cloudformation/stacks/ecs-cluster.yml')
|
2095
|
+
update_stack(stack_name, stack_body, [], tags)
|
2096
|
+
end
|
2097
|
+
|
2098
|
+
def create_alb_stack(stack_name, role, hash, environment = 'qa')
|
2099
|
+
stack_body = IO.read('cloudformation/stacks/elb/alb-public-qa.yml')
|
2100
|
+
parameters = [
|
2101
|
+
{
|
2102
|
+
parameter_key: "Environment",
|
2103
|
+
parameter_value: environment
|
2104
|
+
},
|
2105
|
+
{
|
2106
|
+
parameter_key: "Role",
|
2107
|
+
parameter_value: role
|
2108
|
+
},
|
2109
|
+
{
|
2110
|
+
parameter_key: "EnvHash",
|
2111
|
+
parameter_value: hash
|
2112
|
+
}
|
2113
|
+
]
|
2114
|
+
create_stack(stack_name, stack_body, parameters, [], @cf_role)
|
2115
|
+
end
|
2116
|
+
|
2117
|
+
def import_redis_crash(qa_ip_address)
|
2118
|
+
output "Importo chiavi di Redis da staging\n".yellow
|
2119
|
+
|
2120
|
+
prefixes = ['CODICI', 'fun_with_flags']
|
2121
|
+
redis_qa = Redis.new(:url => "redis://#{qa_ip_address}:6379/10")
|
2122
|
+
redis_staging = Redis.new(:url => 'redis://staging.cache-1.prima.it:6379/10')
|
2123
|
+
|
2124
|
+
prefixes.each do |prefix|
|
2125
|
+
redis_staging.keys("#{prefix}*").each do |key|
|
2126
|
+
next unless redis_qa.keys(key).empty?
|
2127
|
+
output "Importo #{key} dal Redis di staging\n".yellow
|
2128
|
+
dump_staging = redis_staging.dump key
|
2129
|
+
redis_qa.restore key, 0, dump_staging
|
2130
|
+
end
|
2131
|
+
end
|
2132
|
+
end
|
2133
|
+
|
2134
|
+
def import_dbs(ip_address)
|
2135
|
+
overrides = {
|
2136
|
+
container_overrides: [
|
2137
|
+
{
|
2138
|
+
name: 'dbrestore',
|
2139
|
+
environment: [
|
2140
|
+
{
|
2141
|
+
name: 'EC2_IP_ADDRESS',
|
2142
|
+
value: ip_address
|
2143
|
+
}
|
2144
|
+
]
|
2145
|
+
}
|
2146
|
+
]
|
2147
|
+
}
|
2148
|
+
resp = run_ecs_task(get_ecs_cluster_name, @import_db_task, overrides, 1)
|
2149
|
+
return resp
|
2150
|
+
end
|
2151
|
+
|
2152
|
+
def wait_for_db_import(task)
|
2153
|
+
output "Attendo che i DB vengano importati...\n".yellow
|
2154
|
+
stopped_at = nil
|
2155
|
+
sleep 15 # altrimenti non trova il task appena avviato...
|
2156
|
+
while stopped_at.nil?
|
2157
|
+
if task.tasks[0].nil?
|
2158
|
+
pp get_ecs_cluster_name
|
2159
|
+
pp task
|
2160
|
+
stop_if true, "Task di import DB lanciato, ma risposta vuota!".red
|
2161
|
+
end
|
2162
|
+
task = describe_ecs_tasks(task.tasks[0].cluster_arn, [task.tasks[0].task_arn])
|
2163
|
+
stopped_at = task.tasks[0].stopped_at unless task.tasks[0].nil?
|
2164
|
+
sleep_seconds = 10
|
2165
|
+
seconds_elapsed = 0
|
2166
|
+
while true && stopped_at.nil?
|
2167
|
+
break if seconds_elapsed >= sleep_seconds
|
2168
|
+
print '.'.yellow; STDOUT.flush
|
2169
|
+
sleep 1
|
2170
|
+
seconds_elapsed += 1
|
2171
|
+
end
|
2172
|
+
end
|
2173
|
+
print "\n"
|
2174
|
+
end
|
2175
|
+
|
2176
|
+
def get_stacks()
|
2177
|
+
envs = {}
|
2178
|
+
stack_list = stack_list()
|
2179
|
+
stack_list.each do |stack|
|
2180
|
+
unless stack.stack_name.match(/spotfleet-allinone-qa-(\w+)$/)
|
2181
|
+
env_hash = stack.stack_name.match(/qa-(\w+)$/)[0]
|
2182
|
+
envs[env_hash] = stack.tags unless envs.has_key?(env_hash) || stack.tags.empty?
|
2183
|
+
end
|
2184
|
+
end
|
2185
|
+
return stack_list, envs
|
2186
|
+
end
|
2187
|
+
|
2188
|
+
def get_clusters()
|
2189
|
+
envs = {}
|
2190
|
+
cluster_list = cluster_list()
|
2191
|
+
cluster_list.each do |stack|
|
2192
|
+
unless stack.stack_name.match(/spotfleet-allinone-qa-(\w+)$/)
|
2193
|
+
env_hash = stack.stack_name.match(/qa-(\w+)$/)[0]
|
2194
|
+
envs[env_hash] = stack.tags unless envs.has_key?(env_hash) || stack.tags.empty?
|
2195
|
+
end
|
2196
|
+
end
|
2197
|
+
return cluster_list, envs
|
2198
|
+
end
|
2199
|
+
|
2200
|
+
def hostname_pattern_priority()
|
2201
|
+
(Time.now.to_i.to_s[-4..-1].to_i + Random.rand(40000)).to_s
|
2202
|
+
end
|
2203
|
+
|
2204
|
+
def launch_mimo(env_hash)
|
2205
|
+
resp = describe_stack_resource('batch-job-mimo', 'JobDefinition')
|
2206
|
+
|
2207
|
+
@batch.submit_job({
|
2208
|
+
job_name: "mimo-#{get_deploy_id}", # required
|
2209
|
+
job_queue: "tools-production", # required
|
2210
|
+
job_definition: resp.stack_resource_detail.physical_resource_id, # required
|
2211
|
+
container_overrides: {
|
2212
|
+
environment: [
|
2213
|
+
{
|
2214
|
+
name: 'ENV_HASH',
|
2215
|
+
value: env_hash
|
2216
|
+
},
|
2217
|
+
{
|
2218
|
+
name: 'APP_ENV',
|
2219
|
+
value: 'qa'
|
2220
|
+
},
|
2221
|
+
{
|
2222
|
+
name: 'CYPRESS_BASE_URL',
|
2223
|
+
value: "https://hutch-#{env_hash}.qa.colaster.com"
|
2224
|
+
},
|
2225
|
+
{
|
2226
|
+
name: 'CYPRESS_PEANO_BASE_URL',
|
2227
|
+
value: "http://peano-#{env_hash}.qa.colaster.com:10039/quotation"
|
2228
|
+
},
|
2229
|
+
{
|
2230
|
+
name: 'CYPRESS_API_BASE_URL',
|
2231
|
+
value: "https://#{get_route53_hostname("starsky")}/graphql"
|
2232
|
+
},
|
2233
|
+
{
|
2234
|
+
name: 'QA_NAME',
|
2235
|
+
value: @git_branch
|
2236
|
+
}
|
2237
|
+
]
|
2238
|
+
}
|
2239
|
+
})
|
2240
|
+
|
2241
|
+
output "Mimo lanciato con successo!\n".green
|
2242
|
+
end
|
2243
|
+
|
2244
|
+
def get_currently_deployed_version(stack_name)
|
2245
|
+
parameters = get_stack_parameters(stack_name)
|
2246
|
+
currently_deployed_version = nil
|
2247
|
+
parameters.each do |parameter|
|
2248
|
+
if parameter.parameter_key == "ReleaseVersion"
|
2249
|
+
currently_deployed_version = parameter.parameter_value
|
2250
|
+
end
|
2251
|
+
end
|
2252
|
+
currently_deployed_version
|
2253
|
+
end
|
2254
|
+
|
2255
|
+
def get_ami_id(stack_name)
|
2256
|
+
get_stack_parameters(stack_name).each do |param|
|
2257
|
+
if param.parameter_key == "AMIID"
|
2258
|
+
return param.parameter_value
|
2259
|
+
end
|
2260
|
+
end
|
2261
|
+
end
|
2262
|
+
end
|
2263
|
+
|
2264
|
+
def help_content
|
2265
|
+
<<-HELP
|
2266
|
+
|
2267
|
+
twig-buils
|
2268
|
+
===========
|
2269
|
+
|
2270
|
+
Manage qa cloudformation stack creation
|
2271
|
+
|
2272
|
+
Synopsis
|
2273
|
+
--------
|
2274
|
+
|
2275
|
+
twig build #command
|
2276
|
+
|
2277
|
+
Description
|
2278
|
+
-----------
|
2279
|
+
|
2280
|
+
#command #command description
|
2281
|
+
|
2282
|
+
HELP
|
2283
|
+
end
|
2284
|
+
|
2285
|
+
args = ARGV.dup
|
2286
|
+
|
2287
|
+
if args.include?('--help')
|
2288
|
+
puts help_content
|
2289
|
+
exit
|
2290
|
+
end
|
2291
|
+
|
2292
|
+
args.delete('no-gem-update')
|
2293
|
+
|
2294
|
+
Build.new().execute!(args)
|