prima-twig 0.4.8 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/twig-feature +85 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f54c6294a8d6de1afd936fe4dd23546e8c0892e0
|
4
|
+
data.tar.gz: b90237bce967822e05fc8a4ff175021813e4928f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 753ffa07d4ba39a557fba62a6fc43f72aa2153668a38a4520333f04a0b1507358eedebcdb5f25d5c684ba19d49e28f36127cd689d1315392ea1f536f8431fc9d
|
7
|
+
data.tar.gz: bac86029a4ba70b17070a256aae56a705407c4eae60b966380d8f02e7422a1c16d81dc211dbc2b32dfc8d7b9ea11e27f3c440fa7721d0a2e442fcafa7195f9fd
|
data/bin/twig-feature
CHANGED
@@ -22,6 +22,8 @@ class Release
|
|
22
22
|
@import_db_task = 'arn:aws:ecs:eu-west-1:001575623345:task-definition/ecs-task-db-restore-TaskDefinitionDbRestore-8A9N41PAYMJ2:1'
|
23
23
|
@prima_built = false
|
24
24
|
@urania_built = false
|
25
|
+
@ermes_built = false
|
26
|
+
@bburago_built = false
|
25
27
|
@backoffice_built = false
|
26
28
|
@dns_record_identifier = nil
|
27
29
|
@ecs_cluster_name = nil
|
@@ -119,15 +121,16 @@ class Release
|
|
119
121
|
|
120
122
|
def deploy_feature!
|
121
123
|
`sudo true` # cosi' non chiede la password dopo
|
122
|
-
`git pull`
|
124
|
+
`git pull && git submodule init && git submodule update`
|
123
125
|
prima_branch = choose_branch_to_deploy('prima')
|
124
126
|
backoffice_branch = choose_branch_to_deploy('backoffice')
|
125
127
|
urania_branch = choose_branch_to_deploy('urania')
|
126
128
|
ermes_branch = choose_branch_to_deploy('ermes')
|
129
|
+
bburago_branch = choose_branch_to_deploy('bburago')
|
127
130
|
socket_branch = {name: "master"}
|
128
131
|
pamela_branch = {name: "master"}
|
129
132
|
|
130
|
-
@dns_record_identifier = "#{@prima.clean_branch_name(prima_branch[:name])}-#{@prima.clean_branch_name(backoffice_branch[:name])}-#{@prima.clean_branch_name(urania_branch[:name])}-#{@prima.clean_branch_name(ermes_branch[:name])}".gsub(/feature./, '')[0..35].gsub(/(-+$)/, '')
|
133
|
+
@dns_record_identifier = "#{@prima.clean_branch_name(prima_branch[:name])}-#{@prima.clean_branch_name(backoffice_branch[:name])}-#{@prima.clean_branch_name(urania_branch[:name])}-#{@prima.clean_branch_name(ermes_branch[:name])}-#{@prima.clean_branch_name(bburago_branch[:name])}".gsub(/feature./, '')[0..35].gsub(/(-+$)/, '')
|
131
134
|
|
132
135
|
tags = [
|
133
136
|
{
|
@@ -145,10 +148,14 @@ class Release
|
|
145
148
|
{
|
146
149
|
key: "ermes",
|
147
150
|
value: ermes_branch[:name]
|
151
|
+
},
|
152
|
+
{
|
153
|
+
key: "bburago",
|
154
|
+
value: bburago_branch[:name]
|
148
155
|
}
|
149
156
|
]
|
150
157
|
|
151
|
-
deploy_id = Digest::MD5.hexdigest(prima_branch[:name] + backoffice_branch[:name] + urania_branch[:name] + socket_branch[:name] + pamela_branch[:name] + ermes_branch[:name])
|
158
|
+
deploy_id = Digest::MD5.hexdigest(prima_branch[:name] + backoffice_branch[:name] + urania_branch[:name] + socket_branch[:name] + pamela_branch[:name] + ermes_branch[:name] + bburago_branch[:name])
|
152
159
|
|
153
160
|
cluster_stack_name = "ecs-cluster-qa-#{deploy_id}"
|
154
161
|
create_cluster_stack(cluster_stack_name, tags) unless stack_exists?(cluster_stack_name)
|
@@ -177,6 +184,7 @@ class Release
|
|
177
184
|
create_prima_artifact(prima_branch[:revision], prima_branch[:name]) unless artifact_exists?('prima-artifacts', "prima/#{prima_branch[:revision]}")
|
178
185
|
create_urania_artifact(urania_branch[:revision]) unless artifact_exists?('prima-artifacts', "microservices/urania/#{urania_branch[:revision]}-qa.tar.gz")
|
179
186
|
create_ermes_artifact(ermes_branch[:revision]) unless artifact_exists?('prima-artifacts', "microservices/ermes/ermes_#{ermes_branch[:revision]}.tar.gz")
|
187
|
+
create_bburago_artifact(bburago_branch[:revision]) unless artifact_exists?('prima-artifacts', "microservices/bburago/bburago_#{bburago_branch[:revision]}.tar.gz")
|
180
188
|
create_backoffice_artifact(backoffice_branch[:revision], deploy_id) unless artifact_exists?('prima-artifacts', "backoffice/#{backoffice_branch[:revision]}-#{deploy_id}.zip")
|
181
189
|
|
182
190
|
wait_for_stack_ready(stack_name_db) unless stack_ready?(stack_name_db)
|
@@ -283,6 +291,33 @@ class Release
|
|
283
291
|
create_stack(stack_name_ermes, stack_body, parameters, tags)
|
284
292
|
end
|
285
293
|
|
294
|
+
stack_name_bburago = "ecs-task-bburago-qa-#{deploy_id}"
|
295
|
+
git_checkout_version('bburago', bburago_branch[:revision])
|
296
|
+
stack_body = IO.read('projects/bburago/deploy/task.json')
|
297
|
+
parameters = [
|
298
|
+
{
|
299
|
+
parameter_key: "Environment",
|
300
|
+
parameter_value: "qa"
|
301
|
+
},
|
302
|
+
{
|
303
|
+
parameter_key: "ReleaseVersion",
|
304
|
+
parameter_value: bburago_branch[:revision]
|
305
|
+
},
|
306
|
+
{
|
307
|
+
parameter_key: "ECSClusterName",
|
308
|
+
parameter_value: @ecs_cluster_name
|
309
|
+
},
|
310
|
+
{
|
311
|
+
parameter_key: "TaskDesiredCount",
|
312
|
+
parameter_value: "1"
|
313
|
+
}
|
314
|
+
]
|
315
|
+
if stack_exists?(stack_name_bburago)
|
316
|
+
update_stack(stack_name_bburago, stack_body, parameters) if @bburago_built
|
317
|
+
else
|
318
|
+
create_stack(stack_name_bburago, stack_body, parameters, tags)
|
319
|
+
end
|
320
|
+
|
286
321
|
git_checkout_version('backoffice', backoffice_branch[:revision])
|
287
322
|
stack_name_backoffice = "ecs-task-backoffice-qa-#{deploy_id}"
|
288
323
|
stack_body = IO.read('projects/backoffice/deploy/task.json')
|
@@ -315,12 +350,14 @@ class Release
|
|
315
350
|
wait_for_stack_ready(stack_name_urania) unless stack_ready?(stack_name_urania)
|
316
351
|
wait_for_stack_ready(stack_name_backoffice) unless stack_ready?(stack_name_backoffice)
|
317
352
|
wait_for_stack_ready(stack_name_ermes) unless stack_ready?(stack_name_ermes)
|
353
|
+
wait_for_stack_ready(stack_name_bburago) unless stack_ready?(stack_name_bburago)
|
318
354
|
|
319
355
|
update_service_defaults(stack_name_web)
|
320
356
|
update_service_defaults(stack_name_consumer)
|
321
357
|
update_service_defaults(stack_name_urania)
|
322
358
|
update_service_defaults(stack_name_backoffice)
|
323
359
|
update_service_defaults(stack_name_ermes)
|
360
|
+
update_service_defaults(stack_name_bburago)
|
324
361
|
|
325
362
|
stack_name_route53 = "ecs-route53-qa-#{deploy_id}"
|
326
363
|
stack_body = IO.read('cloudformation/stacks/route53/qa.json')
|
@@ -340,12 +377,17 @@ class Release
|
|
340
377
|
{
|
341
378
|
parameter_key: "UraniaElbHostname",
|
342
379
|
parameter_value: get_elb_host(stack_name_urania)
|
380
|
+
},
|
381
|
+
{
|
382
|
+
parameter_key: "BburagoElbHostname",
|
383
|
+
parameter_value: get_elb_host(stack_name_bburago)
|
343
384
|
}
|
344
385
|
]
|
345
386
|
create_stack(stack_name_route53, stack_body, parameters, tags) unless stack_exists?(stack_name_route53)
|
346
387
|
|
347
388
|
prima_hostname = get_route53_hostname(stack_name_web)
|
348
389
|
urania_hostname = get_route53_hostname(stack_name_urania)
|
390
|
+
bburago_hostname = get_route53_hostname(stack_name_bburago)
|
349
391
|
backoffice_hostname = get_route53_hostname(stack_name_backoffice)
|
350
392
|
|
351
393
|
wait_for_stack_ready(stack_name_route53) unless stack_ready?(stack_name_route53)
|
@@ -353,6 +395,7 @@ class Release
|
|
353
395
|
output "Prima url: #{prima_hostname}\n".cyan
|
354
396
|
output "Urania url: #{urania_hostname}\n".cyan
|
355
397
|
output "Backoffice url: #{backoffice_hostname}\n".cyan
|
398
|
+
output "Bburago url: #{bburago_hostname}\n".cyan
|
356
399
|
output "SSH connection: ssh ec2-user@#{ec2_ip_address(asg_stack_name)} -i ~/.ssh/ecs-cluster-qa.pem".cyan
|
357
400
|
output "Deploy effettuato, everything is awesome!\n".green
|
358
401
|
end
|
@@ -365,6 +408,8 @@ class Release
|
|
365
408
|
host = "urania.#{@dns_record_identifier}.qa.colaster.com"
|
366
409
|
when stack_name.include?('backoffice')
|
367
410
|
host = "backoffice.#{@dns_record_identifier}.qa.colaster.com"
|
411
|
+
when stack_name.include?('bburago')
|
412
|
+
host = "bburago.#{@dns_record_identifier}.qa.colaster.com"
|
368
413
|
end
|
369
414
|
host
|
370
415
|
end
|
@@ -391,6 +436,8 @@ class Release
|
|
391
436
|
logical_resource_id = 'EcsElasticLoadBalancerInternal'
|
392
437
|
when stack_name.include?('backoffice')
|
393
438
|
logical_resource_id = 'EcsElasticLoadBalancerPublic'
|
439
|
+
when stack_name.include?('bburago')
|
440
|
+
logical_resource_id = 'EcsElasticLoadBalancerInternal'
|
394
441
|
end
|
395
442
|
resp = @cf.describe_stack_resource({
|
396
443
|
stack_name: stack_name,
|
@@ -415,6 +462,8 @@ class Release
|
|
415
462
|
logical_resource_id = 'ECSServiceBackoffice'
|
416
463
|
when stack_name.include?('ermes')
|
417
464
|
logical_resource_id = 'ECSServiceErmes'
|
465
|
+
when stack_name.include?('bburago')
|
466
|
+
logical_resource_id = 'ECSServiceBburago'
|
418
467
|
else
|
419
468
|
raise "Service name non gestito per lo stack #{stack_name}"
|
420
469
|
end
|
@@ -498,6 +547,39 @@ class Release
|
|
498
547
|
Dir.chdir '../../'
|
499
548
|
end
|
500
549
|
|
550
|
+
def create_bburago_artifact(revision)
|
551
|
+
@bburago_built = true
|
552
|
+
output "Preparo l'artifact .zip\n".yellow
|
553
|
+
|
554
|
+
git_checkout_version('bburago', revision)
|
555
|
+
|
556
|
+
Dir.chdir 'projects/bburago'
|
557
|
+
|
558
|
+
[
|
559
|
+
"docker-compose build web",
|
560
|
+
"docker run -v $PWD:/code -w /code -e MIX_ENV=qa --entrypoint /bin/sh bburago_web \
|
561
|
+
'-c' 'mix local.hex --force && mix hex.info && \
|
562
|
+
mix deps.get && mix compile && mix deps.compile && \
|
563
|
+
mix release.clean --implode --no-confirm && mix release'",
|
564
|
+
"sudo chown -R `whoami` ."
|
565
|
+
].each do |cmd|
|
566
|
+
output "Eseguo #{cmd}".yellow
|
567
|
+
res = %x[ #{cmd} ]
|
568
|
+
if $?.exitstatus != 0
|
569
|
+
color = 'red'
|
570
|
+
else
|
571
|
+
color = 'green'
|
572
|
+
end
|
573
|
+
output res.send color
|
574
|
+
stop_if (color == 'red'), "Errore durante la build dell'artifact".red
|
575
|
+
end
|
576
|
+
|
577
|
+
artifact_path = Dir.glob("rel/bburago/releases/*/bburago.tar.gz").first
|
578
|
+
upload_artifact(artifact_path, "microservices/bburago/bburago_#{revision}.tar.gz")
|
579
|
+
|
580
|
+
Dir.chdir '../../'
|
581
|
+
end
|
582
|
+
|
501
583
|
def create_backoffice_artifact(revision, deploy_id)
|
502
584
|
@backoffice_built = true
|
503
585
|
output "Preparo l'artifact .zip\n".yellow
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prima-twig
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matteo Giachino
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-06-
|
14
|
+
date: 2016-06-28 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: twig
|