prima-twig 0.15.0 → 0.16.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 +96 -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: db916caa0cc3ed242f5c162d4b4f60d87dd245aa
|
4
|
+
data.tar.gz: e9b620de1e2c444bbcef87ec7e7392483a290cde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 138a652e8e9f96abb4e6d2cdaecc86033c271a3dd9839b6404e8972e3936cd210dd3a10cc3f4622c5838d667e2e2cf04b71c60a0fee5c37f8659a81a9ea404e6
|
7
|
+
data.tar.gz: 33bcde18a03ad010b631814e6dff91e34cf9985963409312fb931cb7853be910bb788edc16c77bde5fffa64247b3070b688395f1095a65c96603180031644f95
|
data/bin/twig-feature
CHANGED
@@ -20,11 +20,12 @@ class Release
|
|
20
20
|
@asg = Aws::AutoScaling::Client.new
|
21
21
|
@s3_bucket = 'prima-artifacts'
|
22
22
|
@artifact_path = '/tmp/prima-artifact.zip'
|
23
|
-
@import_db_task = 'arn:aws:ecs:eu-west-1:001575623345:task-definition/ecs-task-db-restore-TaskDefinitionDbRestore-
|
23
|
+
@import_db_task = 'arn:aws:ecs:eu-west-1:001575623345:task-definition/ecs-task-db-restore-TaskDefinitionDbRestore-TMFWBW7DNOYB:1'
|
24
24
|
@prima_built = false
|
25
25
|
@urania_built = false
|
26
26
|
@ermes_built = false
|
27
27
|
@bburago_built = false
|
28
|
+
@hal9000_built = false
|
28
29
|
@backoffice_built = false
|
29
30
|
@dns_record_identifier = nil
|
30
31
|
@ecs_cluster_name = nil
|
@@ -130,10 +131,13 @@ class Release
|
|
130
131
|
urania_branch = choose_branch_to_deploy('urania')
|
131
132
|
ermes_branch = choose_branch_to_deploy('ermes')
|
132
133
|
bburago_branch = choose_branch_to_deploy('bburago')
|
134
|
+
hal9000_branch = choose_branch_to_deploy('hal9000')
|
133
135
|
socket_branch = {name: "master"}
|
134
136
|
pamela_branch = {name: "master"}
|
135
137
|
|
136
|
-
|
138
|
+
|
139
|
+
@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])}-#{@prima.clean_branch_name(hal9000_branch[:name])}"
|
140
|
+
@dns_record_identifier = @dns_record_identifier.gsub(/feature./, '')[0..35].gsub(/(-+$)/, '')
|
137
141
|
|
138
142
|
tags = [
|
139
143
|
{
|
@@ -155,10 +159,14 @@ class Release
|
|
155
159
|
{
|
156
160
|
key: "bburago",
|
157
161
|
value: bburago_branch[:name]
|
162
|
+
},
|
163
|
+
{
|
164
|
+
key: "hal9000",
|
165
|
+
value: hal9000_branch[:name]
|
158
166
|
}
|
159
167
|
]
|
160
168
|
|
161
|
-
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])
|
169
|
+
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] + hal9000_branch[:name])
|
162
170
|
|
163
171
|
cluster_stack_name = "ecs-cluster-qa-#{deploy_id}"
|
164
172
|
create_cluster_stack(cluster_stack_name, tags) unless stack_exists?(cluster_stack_name)
|
@@ -188,6 +196,7 @@ class Release
|
|
188
196
|
create_urania_artifact(urania_branch[:revision]) unless artifact_exists?('prima-artifacts', "microservices/urania/#{urania_branch[:revision]}-qa.tar.gz")
|
189
197
|
create_ermes_artifact(ermes_branch[:revision]) unless artifact_exists?('prima-artifacts', "microservices/ermes/#{ermes_branch[:revision]}-qa.tar.gz")
|
190
198
|
create_bburago_artifact(bburago_branch[:revision]) unless artifact_exists?('prima-artifacts', "microservices/bburago/#{bburago_branch[:revision]}-qa.tar.gz")
|
199
|
+
create_hal9000_artifact(hal9000_branch[:revision]) unless artifact_exists?('prima-artifacts', "microservices/hal9000/#{hal9000_branch[:revision]}-qa.tar.gz")
|
191
200
|
create_backoffice_artifact(backoffice_branch[:revision], deploy_id) unless artifact_exists?('prima-artifacts', "backoffice/#{backoffice_branch[:revision]}-#{deploy_id}.zip")
|
192
201
|
|
193
202
|
wait_for_stack_ready(stack_name_db) unless stack_ready?(stack_name_db)
|
@@ -336,6 +345,37 @@ class Release
|
|
336
345
|
create_stack(stack_name_bburago, stack_body, parameters, tags)
|
337
346
|
end
|
338
347
|
|
348
|
+
stack_name_hal9000 = "ecs-task-hal9000-qa-#{deploy_id}"
|
349
|
+
git_checkout_version('hal9000', hal9000_branch[:revision])
|
350
|
+
stack_body = IO.read('projects/hal9000/deploy/task.yml')
|
351
|
+
parameters = [
|
352
|
+
{
|
353
|
+
parameter_key: "Environment",
|
354
|
+
parameter_value: "qa"
|
355
|
+
},
|
356
|
+
{
|
357
|
+
parameter_key: "ReleaseVersion",
|
358
|
+
parameter_value: hal9000_branch[:revision]
|
359
|
+
},
|
360
|
+
{
|
361
|
+
parameter_key: "ECSClusterName",
|
362
|
+
parameter_value: @ecs_cluster_name
|
363
|
+
},
|
364
|
+
{
|
365
|
+
parameter_key: "TaskDesiredCount",
|
366
|
+
parameter_value: "1"
|
367
|
+
},
|
368
|
+
{
|
369
|
+
parameter_key: "ALBShortName",
|
370
|
+
parameter_value: "ecs-task-hal9000-qa-#{deploy_id}"[0..31]
|
371
|
+
}
|
372
|
+
]
|
373
|
+
if stack_exists?(stack_name_hal9000)
|
374
|
+
update_stack(stack_name_hal9000, stack_body, parameters) if @hal9000_built
|
375
|
+
else
|
376
|
+
create_stack(stack_name_hal9000, stack_body, parameters, tags)
|
377
|
+
end
|
378
|
+
|
339
379
|
git_checkout_version('backoffice', backoffice_branch[:revision])
|
340
380
|
stack_name_backoffice = "ecs-task-backoffice-qa-#{deploy_id}"
|
341
381
|
stack_body = IO.read('projects/backoffice/deploy/task.yml')
|
@@ -373,6 +413,7 @@ class Release
|
|
373
413
|
wait_for_stack_ready(stack_name_backoffice) unless stack_ready?(stack_name_backoffice)
|
374
414
|
wait_for_stack_ready(stack_name_ermes) unless stack_ready?(stack_name_ermes)
|
375
415
|
wait_for_stack_ready(stack_name_bburago) unless stack_ready?(stack_name_bburago)
|
416
|
+
wait_for_stack_ready(stack_name_hal9000) unless stack_ready?(stack_name_hal9000)
|
376
417
|
|
377
418
|
update_service_defaults(stack_name_web)
|
378
419
|
update_service_defaults(stack_name_consumer)
|
@@ -380,6 +421,7 @@ class Release
|
|
380
421
|
update_service_defaults(stack_name_backoffice)
|
381
422
|
update_service_defaults(stack_name_ermes)
|
382
423
|
update_service_defaults(stack_name_bburago)
|
424
|
+
update_service_defaults(stack_name_hal9000)
|
383
425
|
|
384
426
|
stack_name_route53 = "ecs-route53-qa-#{deploy_id}"
|
385
427
|
stack_body = IO.read('cloudformation/stacks/route53/qa.yml')
|
@@ -403,6 +445,10 @@ class Release
|
|
403
445
|
{
|
404
446
|
parameter_key: "BburagoElbHostname",
|
405
447
|
parameter_value: get_alb_host(stack_name_bburago)
|
448
|
+
},
|
449
|
+
{
|
450
|
+
parameter_key: "Hal9000ElbHostname",
|
451
|
+
parameter_value: get_alb_host(stack_name_hal9000)
|
406
452
|
}
|
407
453
|
]
|
408
454
|
create_stack(stack_name_route53, stack_body, parameters, tags) unless stack_exists?(stack_name_route53)
|
@@ -410,6 +456,7 @@ class Release
|
|
410
456
|
prima_hostname = get_route53_hostname(stack_name_web)
|
411
457
|
urania_hostname = get_route53_hostname(stack_name_urania)
|
412
458
|
bburago_hostname = get_route53_hostname(stack_name_bburago)
|
459
|
+
hal9000_hostname = get_route53_hostname(stack_name_hal9000)
|
413
460
|
backoffice_hostname = get_route53_hostname(stack_name_backoffice)
|
414
461
|
|
415
462
|
wait_for_stack_ready(stack_name_route53) unless stack_ready?(stack_name_route53)
|
@@ -419,6 +466,7 @@ class Release
|
|
419
466
|
output "Urania url: #{urania_hostname}\n".cyan
|
420
467
|
output "Backoffice url: #{backoffice_hostname}\n".cyan
|
421
468
|
output "Bburago url: #{bburago_hostname}\n".cyan
|
469
|
+
output "Hal9000 url: #{hal9000_hostname}\n".cyan
|
422
470
|
output "SSH connection: ssh ec2-user@#{ec2_ip_address(asg_stack_name)} -i ~/.ssh/ecs-cluster-qa.pem".cyan
|
423
471
|
output "Deploy effettuato, everything is awesome!\n".green
|
424
472
|
end
|
@@ -433,6 +481,8 @@ class Release
|
|
433
481
|
host = "backoffice-#{@dns_record_identifier}.qa.colaster.com"
|
434
482
|
when stack_name.include?('bburago')
|
435
483
|
host = "bburago-#{@dns_record_identifier}.qa.colaster.com"
|
484
|
+
when stack_name.include?('hal9000')
|
485
|
+
host = "hal9000-#{@dns_record_identifier}.qa.colaster.com"
|
436
486
|
end
|
437
487
|
host
|
438
488
|
end
|
@@ -461,6 +511,8 @@ class Release
|
|
461
511
|
logical_resource_id = 'EcsApplicationLoadBalancerPublic'
|
462
512
|
when stack_name.include?('bburago')
|
463
513
|
logical_resource_id = 'EcsApplicationLoadBalancerInternal'
|
514
|
+
when stack_name.include?('hal9000')
|
515
|
+
logical_resource_id = 'EcsApplicationLoadBalancerInternal'
|
464
516
|
end
|
465
517
|
resp = @cf.describe_stack_resource({
|
466
518
|
stack_name: stack_name,
|
@@ -482,6 +534,8 @@ class Release
|
|
482
534
|
logical_resource_id = 'EcsElasticLoadBalancerPublic'
|
483
535
|
when stack_name.include?('bburago')
|
484
536
|
logical_resource_id = 'EcsElasticLoadBalancerInternal'
|
537
|
+
when stack_name.include?('hal9000')
|
538
|
+
logical_resource_id = 'EcsElasticLoadBalancerInternal'
|
485
539
|
end
|
486
540
|
resp = @cf.describe_stack_resource({
|
487
541
|
stack_name: stack_name,
|
@@ -508,6 +562,8 @@ class Release
|
|
508
562
|
logical_resource_id = 'ECSServiceErmes'
|
509
563
|
when stack_name.include?('bburago')
|
510
564
|
logical_resource_id = 'ECSServiceBburago'
|
565
|
+
when stack_name.include?('hal9000')
|
566
|
+
logical_resource_id = 'ECSServiceHal9000'
|
511
567
|
else
|
512
568
|
raise "Service name non gestito per lo stack #{stack_name}"
|
513
569
|
end
|
@@ -627,6 +683,43 @@ class Release
|
|
627
683
|
Dir.chdir '../../'
|
628
684
|
end
|
629
685
|
|
686
|
+
def create_hal9000_artifact(revision)
|
687
|
+
@hal9000_built = true
|
688
|
+
output "Preparo l'artifact .zip\n".yellow
|
689
|
+
|
690
|
+
git_checkout_version('hal9000', revision)
|
691
|
+
|
692
|
+
Dir.chdir 'projects/hal9000'
|
693
|
+
|
694
|
+
[
|
695
|
+
"docker-compose build web",
|
696
|
+
"docker run -v $PWD:/code -w /code -e MIX_ENV=qa --entrypoint /bin/sh hal9000_web \
|
697
|
+
'-c' 'mix local.hex --force && mix hex.info && \
|
698
|
+
mix deps.get && mix compile && mix deps.compile && \
|
699
|
+
yarn && \
|
700
|
+
./node_modules/.bin/brunch b --production && \
|
701
|
+
mix phoenix.digest && \
|
702
|
+
cp rel/vm.args rel/config.exs /tmp/ && mix release.clean --implode --no-confirm && \
|
703
|
+
mkdir -p rel && mv /tmp/vm.args /tmp/config.exs rel/ && mix release --env=qa'",
|
704
|
+
"sudo chown -R `whoami` ."
|
705
|
+
].each do |cmd|
|
706
|
+
output "Eseguo #{cmd}".yellow
|
707
|
+
res = %x[ #{cmd} ]
|
708
|
+
if $?.exitstatus != 0
|
709
|
+
color = 'red'
|
710
|
+
else
|
711
|
+
color = 'green'
|
712
|
+
end
|
713
|
+
output res.send color
|
714
|
+
stop_if (color == 'red'), "Errore durante la build dell'artifact".red
|
715
|
+
end
|
716
|
+
|
717
|
+
artifact_path = Dir.glob("_build/qa/rel/hal9000/releases/*/hal9000.tar.gz").first
|
718
|
+
upload_artifact(artifact_path, "microservices/hal9000/#{revision}-qa.tar.gz")
|
719
|
+
|
720
|
+
Dir.chdir '../../'
|
721
|
+
end
|
722
|
+
|
630
723
|
def create_backoffice_artifact(revision, deploy_id)
|
631
724
|
@backoffice_built = true
|
632
725
|
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.16.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: 2017-01-
|
14
|
+
date: 2017-01-28 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: twig
|