prima-twig 1.0.31 → 1.0.36
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/twig-build +153 -4
- data/bin/twig-feature +4 -1
- data/lib/prima_aws_client.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1417bd2d0c1dec05b038757db96002cf05bd8f31816987e6e83b1154be96bafa
|
4
|
+
data.tar.gz: 39a8b4a36c16530fb208a8cbc90ef56582f2c606dea0e0bdef6a12a2398f3cc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f55c523a626e25b31217b13365d3095342847c0d4b7b430d31c1879a1818dea2c19fa9ed1ee7fd520a1518d02a18fe5cf5a79d91b8849f85812499a31c398c9
|
7
|
+
data.tar.gz: 6f49ddadb30b6bc06bb79c2694da9cfce26e4ea034abf450b96a2f50dd85313c2b09f5a179ac1fc92d71b48e59053fc9ec63ca4aae0a1618dbe83e645b6b8630
|
data/bin/twig-build
CHANGED
@@ -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-
|
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
|
@@ -48,8 +48,8 @@ class Build
|
|
48
48
|
'maia' => {},
|
49
49
|
'legion' => {},
|
50
50
|
'vianello' => {},
|
51
|
-
'domus' => {}
|
52
|
-
|
51
|
+
'domus' => {},
|
52
|
+
'toretto' => {}
|
53
53
|
}
|
54
54
|
@base_stack_name_alb = 'ecs-alb-http-public-qa-'
|
55
55
|
@base_stack_name_alb_ws = 'ecs-alb-ws-public-qa-'
|
@@ -211,7 +211,9 @@ class Build
|
|
211
211
|
}
|
212
212
|
]
|
213
213
|
@projects.each do |key, value|
|
214
|
-
|
214
|
+
unless value['name'].to_s.strip.empty?
|
215
|
+
@tags << { key: key, value: value['name'] }
|
216
|
+
end
|
215
217
|
end
|
216
218
|
end
|
217
219
|
|
@@ -370,6 +372,14 @@ class Build
|
|
370
372
|
{
|
371
373
|
parameter_key: 'DomusElbHostname',
|
372
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)
|
373
383
|
}
|
374
384
|
]
|
375
385
|
|
@@ -1545,6 +1555,112 @@ class Build
|
|
1545
1555
|
end
|
1546
1556
|
end
|
1547
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
|
+
|
1548
1664
|
def create_rogoreport_stack()
|
1549
1665
|
true
|
1550
1666
|
end
|
@@ -1565,6 +1681,10 @@ class Build
|
|
1565
1681
|
wait_for_stack_ready(get_stack_name("vianello")) unless stack_ready?(get_stack_name("vianello"))
|
1566
1682
|
wait_for_stack_ready(get_stack_name("domus")) unless stack_ready?(get_stack_name("domus"))
|
1567
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
|
1568
1688
|
|
1569
1689
|
update_service_defaults(get_stack_name("web"))
|
1570
1690
|
update_service_defaults(get_stack_name("consumer-api"))
|
@@ -1590,6 +1710,10 @@ class Build
|
|
1590
1710
|
update_service_defaults(get_stack_name("vianello"))
|
1591
1711
|
update_service_defaults(get_stack_name("domus"))
|
1592
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
|
1593
1717
|
|
1594
1718
|
activia_hostname = get_route53_hostname("activia")
|
1595
1719
|
assange_hostname = get_route53_hostname("assange")
|
@@ -1613,6 +1737,8 @@ class Build
|
|
1613
1737
|
legion_hostname = get_route53_hostname("legion")
|
1614
1738
|
vianello_hostname = get_route53_hostname("vianello")
|
1615
1739
|
domus_hostname = get_route53_hostname("domus")
|
1740
|
+
toretto_hostname = get_route53_hostname("toretto")
|
1741
|
+
toretto_fe_hostname = get_route53_hostname("toretto_fe")
|
1616
1742
|
|
1617
1743
|
#launch_mimo(get_deploy_id)
|
1618
1744
|
|
@@ -1641,6 +1767,9 @@ projects_text.concat "
|
|
1641
1767
|
> Vianello url: https://#{vianello_hostname}
|
1642
1768
|
> Domus url: https://#{domus_hostname}" if deploy_vianello_or_domus?
|
1643
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 "
|
1644
1773
|
> RabbitMQ url: http://#{get_ec2_ip_address}:15672
|
1645
1774
|
> Elasticsearch url: http://#{get_ec2_ip_address}:9200
|
1646
1775
|
> Git branch: #{@git_branch}
|
@@ -1708,6 +1837,10 @@ projects_text.concat "
|
|
1708
1837
|
host = "vianello-#{get_deploy_id}.qa.colaster.com"
|
1709
1838
|
when project.include?('domus')
|
1710
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"
|
1711
1844
|
end
|
1712
1845
|
host
|
1713
1846
|
end
|
@@ -1773,6 +1906,10 @@ projects_text.concat "
|
|
1773
1906
|
logical_resource_id = 'EcsApplicationLoadBalancerInternal'
|
1774
1907
|
when stack_name.include?('domus')
|
1775
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'
|
1776
1913
|
end
|
1777
1914
|
resp = describe_stack_resource(stack_name, logical_resource_id)
|
1778
1915
|
resp = describe_load_balancers([resp.stack_resource_detail.physical_resource_id])
|
@@ -1829,6 +1966,10 @@ projects_text.concat "
|
|
1829
1966
|
logical_resource_id = 'ECSServiceVianelloQA'
|
1830
1967
|
when stack_name.include?('domus')
|
1831
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'
|
1832
1973
|
else
|
1833
1974
|
raise "Service name non gestito per lo stack #{stack_name}"
|
1834
1975
|
end
|
@@ -1908,11 +2049,19 @@ projects_text.concat "
|
|
1908
2049
|
end
|
1909
2050
|
|
1910
2051
|
def deploy_vianello_or_domus?
|
2052
|
+
puts "check vianello #{!@projects['vianello'].empty?} #{@projects['vianello'][:name] != 'master'} #{@projects} #{@projects['vianello']} #{@projects['vianello'][:default_branch] != 'true'}"
|
1911
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]}"
|
1912
2055
|
domus_present = !@projects['domus'].empty? && @projects['domus'][:name] != 'master' && !@projects['domus'][:default_branch]
|
1913
2056
|
vianello_present || domus_present
|
1914
2057
|
end
|
1915
2058
|
|
2059
|
+
def deploy_toretto?
|
2060
|
+
toretto_present = !@projects['toretto'].empty? && @projects['toretto'][:name] != 'master' && @projects['toretto'][:default_branch] != 'true'
|
2061
|
+
crash_present = !@projects['crash'].empty? && @projects['crash'][:name] != 'master' && !@projects['crash'][:default_branch] != 'true'
|
2062
|
+
toretto_present || crash_present
|
2063
|
+
end
|
2064
|
+
|
1916
2065
|
def git_checkout_version(project, revision)
|
1917
2066
|
Dir.chdir "projects/#{project}"
|
1918
2067
|
exec_step "git checkout -- . && git checkout #{revision}"
|
data/bin/twig-feature
CHANGED
@@ -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-'
|
data/lib/prima_aws_client.rb
CHANGED
@@ -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::
|
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.
|
4
|
+
version: 1.0.36
|
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-
|
17
|
+
date: 2020-07-02 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: aws-sdk-autoscaling
|