prima-twig 1.0.29 → 1.0.34

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dbea057742da31a466ee69c08955e9e9d3096e248886f2b76a5236c459eefe5e
4
- data.tar.gz: c8d2764325ef6c3b9c51b72db950f8420b6a5305a842fd4a90e274288f3a870f
3
+ metadata.gz: 67ceeb3b9113685b9f47c97d844da6a41c87cbc3b6ab68bceea1fd411fdabc84
4
+ data.tar.gz: 58adab2ea851b5c6160a312e5be9f00a55548136479f542abc858afe2ef5acf5
5
5
  SHA512:
6
- metadata.gz: 4a58fcfdf2d6e3e84ab4ff36ff06e8f839275d222c4c107e9155de8e3189f64aea09b358eb51e5655b764fba676debb11e518cc6bd9d79b6edbe442f74436678
7
- data.tar.gz: cb3a4a54ce7ff42db572ae7665f9496ea557ac3396adb4e5f2d6eb8747dabc3a5cf7ddb826f97b24895efdafdc0fd2454fd25240dc182ac8856cd69282a1f0ec
6
+ metadata.gz: a1923c8a0abe8251f13b2a85a3004c2e05cc33ceda64517f6043c5c7bb6d9184e667ae5bda9b4e0ac72d7fb2cec2526f47c281d7a1b8a6d96fba356958abf398
7
+ data.tar.gz: edbc54a73fceb11c6fcde0861e00b0fbae49e91f37ba9b4883ca4123e90bce6b97951f71134246ed22b766f1ff79dca8dfc8f7064fd8d39a4960853706c830c0
@@ -19,7 +19,7 @@ class Build
19
19
  @s3 = Aws::S3::Client.new
20
20
  @s3_bucket = 'prima-artifacts'
21
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-4UBHMCZBE5WM:1'
22
+ @import_db_task = 'arn:aws:ecs:eu-west-1:001575623345:task-definition/ecs-task-db-restore2-TaskDefinitionDbRestore-XYF2QX2UJRXZ:1'
23
23
  @cf_role = 'arn:aws:iam::001575623345:role/qainit-service-role-cloudformat-CloudformationRole-18KBZQIS148R9'
24
24
  @ecs_cluster_name = nil
25
25
  @deploy_update = false
@@ -46,7 +46,10 @@ class Build
46
46
  'starsky' => {},
47
47
  'hutch' => {},
48
48
  'maia' => {},
49
- 'legion' => {}
49
+ 'legion' => {},
50
+ 'vianello' => {},
51
+ 'domus' => {},
52
+ 'toretto' => {}
50
53
  }
51
54
  @base_stack_name_alb = 'ecs-alb-http-public-qa-'
52
55
  @base_stack_name_alb_ws = 'ecs-alb-ws-public-qa-'
@@ -200,7 +203,7 @@ class Build
200
203
  @tags = [
201
204
  {
202
205
  key: "qainit",
203
- value: @git_branch
206
+ value: @git_branch.gsub(/[^a-zA-Z0-9\-]/,"-")
204
207
  },
205
208
  {
206
209
  key: "hostname_pattern_priority",
@@ -208,7 +211,9 @@ class Build
208
211
  }
209
212
  ]
210
213
  @projects.each do |key, value|
211
- @tags << { key: key, value: value['name'] }
214
+ unless value['name'].to_s.strip.empty?
215
+ @tags << { key: key, value: value['name'] }
216
+ end
212
217
  end
213
218
  end
214
219
 
@@ -359,6 +364,22 @@ class Build
359
364
  {
360
365
  parameter_key: 'MaiaElbHostname',
361
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)
362
383
  }
363
384
  ]
364
385
 
@@ -1426,6 +1447,220 @@ class Build
1426
1447
  end
1427
1448
  end
1428
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
+ parameter_key: "AllowedOrigin",
1600
+ parameter_value: "https://#{get_route53_hostname('toretto_fe')}"
1601
+ }
1602
+ ]
1603
+ if stack_exists?(stack_name_toretto)
1604
+ cur_version = get_currently_deployed_version(stack_name_toretto)
1605
+ unless cur_version.include?(@projects["toretto"]['revision'])
1606
+ delete_stack(stack_name_toretto)
1607
+ wait_for_stack_removal(stack_name_toretto)
1608
+ create_stack(stack_name_toretto, stack_body, parameters, @tags, @cf_role)
1609
+ end
1610
+ else
1611
+ create_stack(stack_name_toretto, stack_body, parameters, @tags, @cf_role)
1612
+ end
1613
+
1614
+ wait_for_artifact('prima-artifacts-encrypted', "microservices/toretto/fe-#{@projects["toretto"]['revision']}-#{get_deploy_id[0..7]}-qa.tar.gz")
1615
+
1616
+ stack_name_toretto_fe = get_stack_name("toretto-fe")
1617
+ git_checkout_version('toretto', @projects["toretto"]['revision'])
1618
+ stack_body = File.read('projects/toretto/deploy/task-fe.yml')
1619
+ parameters = [
1620
+ {
1621
+ parameter_key: "Environment",
1622
+ parameter_value: "qa"
1623
+ },
1624
+ {
1625
+ parameter_key: "ReleaseVersion",
1626
+ parameter_value: "#{@projects["toretto"]['revision']}-#{get_deploy_id[0..7]}"
1627
+ },
1628
+ {
1629
+ parameter_key: "ALBShortName",
1630
+ parameter_value: "toretto-fe-qa-#{get_deploy_id}"[0..27]
1631
+ },
1632
+ {
1633
+ parameter_key: "ECSClusterName",
1634
+ parameter_value: get_ecs_cluster_name
1635
+ },
1636
+ {
1637
+ parameter_key: "EnvHash",
1638
+ parameter_value: get_deploy_id
1639
+ },
1640
+ {
1641
+ parameter_key: "HostnamePattern",
1642
+ parameter_value: "carrozzerie-#{get_deploy_id}.qa.colaster.com"
1643
+ },
1644
+ {
1645
+ parameter_key: "HostnamePatternPriority",
1646
+ parameter_value: (hostname_pattern_priority.to_i + 254).to_s
1647
+ },
1648
+ {
1649
+ parameter_key: "ApiUrl",
1650
+ parameter_value: "https://#{get_route53_hostname('toretto')}"
1651
+ }
1652
+ ]
1653
+ if stack_exists?(stack_name_toretto_fe)
1654
+ cur_version = get_currently_deployed_version(stack_name_toretto_fe)
1655
+ update_stack(stack_name_toretto_fe, stack_body, parameters, @tags, @cf_role) unless cur_version.include?(@projects["toretto"]['revision'])
1656
+ else
1657
+ create_stack(stack_name_toretto_fe, stack_body, parameters, @tags, @cf_role)
1658
+ end
1659
+ else
1660
+ true
1661
+ end
1662
+ end
1663
+
1429
1664
  def create_rogoreport_stack()
1430
1665
  true
1431
1666
  end
@@ -1442,6 +1677,14 @@ class Build
1442
1677
  wait_for_stack_ready(get_stack_name("maia")) unless stack_ready?(get_stack_name("maia"))
1443
1678
  wait_for_stack_ready(get_stack_name("crash")) unless stack_ready?(get_stack_name("crash"))
1444
1679
  wait_for_stack_ready(get_stack_name("hutch")) unless stack_ready?(get_stack_name("hutch"))
1680
+ if deploy_vianello_or_domus?
1681
+ wait_for_stack_ready(get_stack_name("vianello")) unless stack_ready?(get_stack_name("vianello"))
1682
+ wait_for_stack_ready(get_stack_name("domus")) unless stack_ready?(get_stack_name("domus"))
1683
+ end
1684
+ if deploy_toretto?
1685
+ wait_for_stack_ready(get_stack_name("toretto")) unless stack_ready?(get_stack_name("toretto"))
1686
+ wait_for_stack_ready(get_stack_name("toretto-fe")) unless stack_ready?(get_stack_name("toretto-fe"))
1687
+ end
1445
1688
 
1446
1689
  update_service_defaults(get_stack_name("web"))
1447
1690
  update_service_defaults(get_stack_name("consumer-api"))
@@ -1463,6 +1706,14 @@ class Build
1463
1706
  update_service_defaults(get_stack_name("starsky"))
1464
1707
  update_service_defaults(get_stack_name("hutch"))
1465
1708
  update_service_defaults(get_stack_name("crash"))
1709
+ if deploy_vianello_or_domus?
1710
+ update_service_defaults(get_stack_name("vianello"))
1711
+ update_service_defaults(get_stack_name("domus"))
1712
+ end
1713
+ if deploy_toretto?
1714
+ update_service_defaults(get_stack_name("toretto"))
1715
+ update_service_defaults(get_stack_name("toretto-fe"))
1716
+ end
1466
1717
 
1467
1718
  activia_hostname = get_route53_hostname("activia")
1468
1719
  assange_hostname = get_route53_hostname("assange")
@@ -1484,6 +1735,10 @@ class Build
1484
1735
  starsky_hostname = get_route53_hostname("starsky")
1485
1736
  hutch_hostname = get_route53_hostname("hutch")
1486
1737
  legion_hostname = get_route53_hostname("legion")
1738
+ vianello_hostname = get_route53_hostname("vianello")
1739
+ domus_hostname = get_route53_hostname("domus")
1740
+ toretto_hostname = get_route53_hostname("toretto")
1741
+ toretto_fe_hostname = get_route53_hostname("toretto_fe")
1487
1742
 
1488
1743
  #launch_mimo(get_deploy_id)
1489
1744
 
@@ -1507,7 +1762,14 @@ class Build
1507
1762
  > Legion url: http://#{legion_hostname}:8051
1508
1763
  > Crash url: https://#{crash_hostname}
1509
1764
  > Starsky url: https://#{starsky_hostname}
1510
- > Hutch url: https://#{hutch_hostname}
1765
+ > Hutch url: https://#{hutch_hostname}"
1766
+ projects_text.concat "
1767
+ > Vianello url: https://#{vianello_hostname}
1768
+ > Domus url: https://#{domus_hostname}" if deploy_vianello_or_domus?
1769
+ projects_text.concat "
1770
+ > Toretto url: https://#{toretto_fe_hostname}
1771
+ > Toretto Backend url: https://#{toretto_hostname}" if deploy_toretto?
1772
+ projects_text.concat "
1511
1773
  > RabbitMQ url: http://#{get_ec2_ip_address}:15672
1512
1774
  > Elasticsearch url: http://#{get_ec2_ip_address}:9200
1513
1775
  > Git branch: #{@git_branch}
@@ -1571,6 +1833,14 @@ class Build
1571
1833
  host = "legion-#{get_deploy_id}.qa.colaster.com"
1572
1834
  when project.include?('maia-intermediari')
1573
1835
  host = "api-intermediari-#{get_deploy_id}.qa.colaster.com"
1836
+ when project.include?('vianello')
1837
+ host = "vianello-#{get_deploy_id}.qa.colaster.com"
1838
+ when project.include?('domus')
1839
+ host = "domus-#{get_deploy_id}.qa.colaster.com"
1840
+ when project.include?('toretto_fe')
1841
+ host = "carrozzerie-#{get_deploy_id}.qa.colaster.com"
1842
+ when project.include?('toretto')
1843
+ host = "carrozzerie-api-#{get_deploy_id}.qa.colaster.com"
1574
1844
  end
1575
1845
  host
1576
1846
  end
@@ -1632,6 +1902,14 @@ class Build
1632
1902
  logical_resource_id = 'EcsApplicationLoadBalancerPublic'
1633
1903
  when stack_name.include?('legion')
1634
1904
  logical_resource_id = 'EcsApplicationLoadBalancerInternal'
1905
+ when stack_name.include?('vianello')
1906
+ logical_resource_id = 'EcsApplicationLoadBalancerInternal'
1907
+ when stack_name.include?('domus')
1908
+ logical_resource_id = 'EcsApplicationLoadBalancerPublic'
1909
+ when stack_name.include?('toretto_fe')
1910
+ logical_resource_id = 'EcsApplicationLoadBalancerPublic'
1911
+ when stack_name.include?('toretto')
1912
+ logical_resource_id = 'EcsApplicationLoadBalancerPublic'
1635
1913
  end
1636
1914
  resp = describe_stack_resource(stack_name, logical_resource_id)
1637
1915
  resp = describe_load_balancers([resp.stack_resource_detail.physical_resource_id])
@@ -1684,6 +1962,14 @@ class Build
1684
1962
  logical_resource_id = 'ECSServiceMaia'
1685
1963
  when stack_name.include?('legion')
1686
1964
  logical_resource_id = 'ECSServiceLegionQA'
1965
+ when stack_name.include?('vianello')
1966
+ logical_resource_id = 'ECSServiceVianelloQA'
1967
+ when stack_name.include?('domus')
1968
+ logical_resource_id = 'ECSServiceDomus'
1969
+ when stack_name.include?('toretto-fe')
1970
+ logical_resource_id = 'ECSServiceToretto'
1971
+ when stack_name.include?('toretto')
1972
+ logical_resource_id = 'ECSServiceTorettoQA'
1687
1973
  else
1688
1974
  raise "Service name non gestito per lo stack #{stack_name}"
1689
1975
  end
@@ -1762,6 +2048,20 @@ class Build
1762
2048
  })
1763
2049
  end
1764
2050
 
2051
+ def deploy_vianello_or_domus?
2052
+ puts "check vianello #{!@projects['vianello'].empty?} #{@projects['vianello'][:name] != 'master'} #{!@projects['vianello'][:default_branch]}"
2053
+ vianello_present = !@projects['vianello'].empty? && @projects['vianello'][:name] != 'master' && !@projects['vianello'][:default_branch]
2054
+ puts "check domus #{!@projects['domus'].empty?} #{@projects['domus'][:name] != 'master'} #{!@projects['domus'][:default_branch]}"
2055
+ domus_present = !@projects['domus'].empty? && @projects['domus'][:name] != 'master' && !@projects['domus'][:default_branch]
2056
+ vianello_present || domus_present
2057
+ end
2058
+
2059
+ def deploy_toretto?
2060
+ toretto_present = !@projects['toretto'].empty? && @projects['toretto'][:name] != 'master' && !@projects['toretto'][:default_branch]
2061
+ crash_present = !@projects['crash'].empty? && @projects['crash'][:name] != 'master' && !@projects['crash'][:default_branch]
2062
+ toretto_present || crash_present
2063
+ end
2064
+
1765
2065
  def git_checkout_version(project, revision)
1766
2066
  Dir.chdir "projects/#{project}"
1767
2067
  exec_step "git checkout -- . && git checkout #{revision}"
@@ -46,7 +46,10 @@ class Release
46
46
  'starsky' => {},
47
47
  'hutch' => {},
48
48
  'maia' => {},
49
- 'legion' => {}
49
+ 'legion' => {},
50
+ 'vianello' => {},
51
+ 'domus' => {},
52
+ 'toretto' => {}
50
53
  }
51
54
  @base_stack_name_alb = 'ecs-alb-http-public-qa-'
52
55
  @base_stack_name_alb_ws = 'ecs-alb-ws-public-qa-'
@@ -434,6 +437,8 @@ class Release
434
437
  def qainit_deploy!(quiet = false)
435
438
  `git checkout master && git pull && git submodule update --init --recursive && git remote prune origin`
436
439
 
440
+ `git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -D`
441
+
437
442
  default_name = get_default_branch_name @projects
438
443
  feature_number = ''
439
444
  unless quiet
@@ -340,7 +340,7 @@ module PrimaAwsClient
340
340
  def wait_for_artifact(bucket, path)
341
341
  ready = artifact_exists?(bucket, path)
342
342
  sleep_seconds = 13
343
- output "Attendo che lo sia pronto l'artefatto #{path}...\n".yellow
343
+ output "Attendo che sia pronto l'artefatto #{path}...\n".yellow
344
344
  retries = 0
345
345
  while !ready
346
346
  ready = true if artifact_exists?(bucket, path)
@@ -416,7 +416,7 @@ module PrimaAwsClient
416
416
  def describe_load_balancers(load_balancer_arns)
417
417
  begin
418
418
  resp = alb_client.describe_load_balancers({load_balancer_arns: load_balancer_arns})
419
- rescue Aws::CloudFormation::Errors::Throttling => e
419
+ rescue Aws::ElasticLoadBalancingV2::Errors::Throttling => e
420
420
  output 'Throttling, retrying in 15 seconds'.red
421
421
  sleep 15
422
422
  resp = describe_load_balancers(load_balancer_arns)
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: 1.0.29
4
+ version: 1.0.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matteo Giachino
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2020-06-08 00:00:00.000000000 Z
17
+ date: 2020-07-01 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: aws-sdk-autoscaling