prima-twig 0.62.14 → 0.62.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/twig-feature +53 -113
- data/bin/twig-update-ami +22 -27
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 535bfd11c3493fd0cdcd803cb3bdd2362d32b1906ba2ceab21e8b3eb43eb4247
|
|
4
|
+
data.tar.gz: 4e5ab696bc9633fe029f7081a42e998e2133b142baa62363ae1f5137ecfba4ab
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1e61b9ec19e1c0316abc18875b0bd38d7bbf22fc6004d54100f2665bf1c0ba9b2a18655cc1c8d25473d2d71be3506e6d6336ad9e8178824dcb7ac8c32341c63e
|
|
7
|
+
data.tar.gz: b6b16a0832f22d2ba56dd9fa5a776f27b552a9eb5304afd5aae749430a316fa0026896ab58cfe63f52ec5adb5f92d248b11497691eab97fbf7784f7b11af8c81
|
data/bin/twig-feature
CHANGED
|
@@ -26,7 +26,7 @@ class Release
|
|
|
26
26
|
@s3 = Aws::S3::Client.new
|
|
27
27
|
@s3_bucket = 'prima-artifacts'
|
|
28
28
|
@artifact_path = '/tmp/prima-artifact.zip'
|
|
29
|
-
@import_db_task = 'arn:aws:ecs:eu-west-1:001575623345:task-definition/ecs-task-db-restore2-TaskDefinitionDbRestore-
|
|
29
|
+
@import_db_task = 'arn:aws:ecs:eu-west-1:001575623345:task-definition/ecs-task-db-restore2-TaskDefinitionDbRestore-4UBHMCZBE5WM:1'
|
|
30
30
|
@cf_role = 'arn:aws:iam::001575623345:role/qainit-service-role-cloudformat-CloudformationRole-18KBZQIS148R9'
|
|
31
31
|
@dns_record_identifier = nil
|
|
32
32
|
@ecs_cluster_name = nil
|
|
@@ -1510,20 +1510,20 @@ class Release
|
|
|
1510
1510
|
|
|
1511
1511
|
stack_name_web = "ecs-task-web-qa-#{deploy_id}"
|
|
1512
1512
|
git_checkout_version('prima', @projects["prima"]['revision'])
|
|
1513
|
-
stack_body = IO.read('projects/prima/app/cloudformation/tasks/web.yml')
|
|
1513
|
+
stack_body = IO.read('projects/prima/app/cloudformation/tasks/web-qa.yml')
|
|
1514
1514
|
parameters = [
|
|
1515
|
-
{
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
},
|
|
1515
|
+
# {
|
|
1516
|
+
# parameter_key: "Environment",
|
|
1517
|
+
# parameter_value: "qa"
|
|
1518
|
+
# },
|
|
1519
1519
|
{
|
|
1520
1520
|
parameter_key: "ReleaseVersion",
|
|
1521
1521
|
parameter_value: "#{@projects["prima"]['revision']}"
|
|
1522
1522
|
},
|
|
1523
|
-
{
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
},
|
|
1523
|
+
# {
|
|
1524
|
+
# parameter_key: "TaskDesiredCount",
|
|
1525
|
+
# parameter_value: "1"
|
|
1526
|
+
# },
|
|
1527
1527
|
{
|
|
1528
1528
|
parameter_key: "ECSClusterName",
|
|
1529
1529
|
parameter_value: @ecs_cluster_name
|
|
@@ -1591,30 +1591,6 @@ class Release
|
|
|
1591
1591
|
{
|
|
1592
1592
|
parameter_key: "ECSClusterName",
|
|
1593
1593
|
parameter_value: @ecs_cluster_name
|
|
1594
|
-
},
|
|
1595
|
-
{
|
|
1596
|
-
parameter_key: "NginxHttpHost",
|
|
1597
|
-
parameter_value: "www-#{@dns_record_identifier}.qa.colaster.com"
|
|
1598
|
-
},
|
|
1599
|
-
{
|
|
1600
|
-
parameter_key: "AssangeHostname",
|
|
1601
|
-
parameter_value: "assange-#{@dns_record_identifier}.qa.colaster.com"
|
|
1602
|
-
},
|
|
1603
|
-
{
|
|
1604
|
-
parameter_key: "BackofficeHostname",
|
|
1605
|
-
parameter_value: "backoffice-#{@dns_record_identifier}.qa.colaster.com"
|
|
1606
|
-
},
|
|
1607
|
-
{
|
|
1608
|
-
parameter_key: "WebHostname",
|
|
1609
|
-
parameter_value: "www-#{@dns_record_identifier}.qa.colaster.com"
|
|
1610
|
-
},
|
|
1611
|
-
{
|
|
1612
|
-
parameter_key: "FePrimaDomain",
|
|
1613
|
-
parameter_value: "www-#{@dns_record_identifier}.qa.colaster.com"
|
|
1614
|
-
},
|
|
1615
|
-
{
|
|
1616
|
-
parameter_key: "HostnamePattern",
|
|
1617
|
-
parameter_value: "consumer-#{@dns_record_identifier}.qa.colaster.com"
|
|
1618
1594
|
}
|
|
1619
1595
|
]
|
|
1620
1596
|
if stack_exists?(stack_name_consumer)
|
|
@@ -1810,8 +1786,7 @@ class Release
|
|
|
1810
1786
|
starsky_hostname = get_route53_hostname("starsky") unless !deploy_starsky_hutch?
|
|
1811
1787
|
hutch_hostname = get_route53_hostname("hutch") unless !deploy_starsky_hutch?
|
|
1812
1788
|
|
|
1813
|
-
|
|
1814
|
-
# launch_marley ec2_ip_address(asg_stack_name), prima_hostname, borat_hostname
|
|
1789
|
+
launch_mimo(deploy_id) if deploy_starsky_hutch?
|
|
1815
1790
|
|
|
1816
1791
|
projects_text = "
|
|
1817
1792
|
> Prima url: https://#{prima_hostname}
|
|
@@ -2091,26 +2066,7 @@ class Release
|
|
|
2091
2066
|
exec_step 'cp docker-compose.yml docker-compose-ci.yml'
|
|
2092
2067
|
exec_step 'prepare-docker-compose --directory activia && cp docker-compose-qainit.yml docker-compose.yml'
|
|
2093
2068
|
|
|
2094
|
-
|
|
2095
|
-
execute_command "deploy/build_qa_artifact"
|
|
2096
|
-
else
|
|
2097
|
-
[
|
|
2098
|
-
"docker-compose build web",
|
|
2099
|
-
"docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
|
|
2100
|
-
'-c' 'mix local.hex --force && mix hex.info && \
|
|
2101
|
-
mix deps.get && mix compile && mix deps.compile && \
|
|
2102
|
-
cd assets && \
|
|
2103
|
-
rm -rf node_modules && \
|
|
2104
|
-
yarn --cache-folder ~/.cache/yarn && \
|
|
2105
|
-
sysconfcpus -n 2 ./node_modules/.bin/webpack --mode production && \
|
|
2106
|
-
cd .. && \
|
|
2107
|
-
mix phx.digest && \
|
|
2108
|
-
rm -rf _build/qa/rel/ && \
|
|
2109
|
-
mix release --env=qa'"
|
|
2110
|
-
].each do |cmd|
|
|
2111
|
-
execute_command cmd
|
|
2112
|
-
end
|
|
2113
|
-
end
|
|
2069
|
+
execute_command "deploy/build_qa_artifact"
|
|
2114
2070
|
|
|
2115
2071
|
cleanup_containers
|
|
2116
2072
|
|
|
@@ -2180,27 +2136,7 @@ class Release
|
|
|
2180
2136
|
exec_step 'cp docker-compose.yml docker-compose-ci.yml'
|
|
2181
2137
|
exec_step 'prepare-docker-compose --directory borat && cp docker-compose-qainit.yml docker-compose.yml'
|
|
2182
2138
|
|
|
2183
|
-
|
|
2184
|
-
execute_command "deploy/build_qa_artifact"
|
|
2185
|
-
else
|
|
2186
|
-
[
|
|
2187
|
-
"docker network create borat_network || true",
|
|
2188
|
-
"docker-compose build web",
|
|
2189
|
-
"docker-compose run -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
|
|
2190
|
-
'-c' 'mix local.hex --force && mix hex.info && \
|
|
2191
|
-
mix deps.get && \
|
|
2192
|
-
cd assets && \
|
|
2193
|
-
yarn --cache-folder ~/.cache/yarn && \
|
|
2194
|
-
sysconfcpus -n 2 ./node_modules/.bin/webpack -p --config config/webpack.config.prod.js && \
|
|
2195
|
-
cd ../ && \
|
|
2196
|
-
mix phx.digest && \
|
|
2197
|
-
mix compile && mix deps.compile && \
|
|
2198
|
-
rm -rf _build/qa/rel/ && \
|
|
2199
|
-
mix distillery.release --env=qa'"
|
|
2200
|
-
].each do |cmd|
|
|
2201
|
-
execute_command cmd
|
|
2202
|
-
end
|
|
2203
|
-
end
|
|
2139
|
+
execute_command "deploy/build_qa_artifact"
|
|
2204
2140
|
|
|
2205
2141
|
cleanup_containers
|
|
2206
2142
|
|
|
@@ -2246,27 +2182,26 @@ class Release
|
|
|
2246
2182
|
exec_step 'cp docker-compose.yml docker-compose-ci.yml'
|
|
2247
2183
|
exec_step 'prepare-docker-compose --directory ermes && cp docker-compose-qainit.yml docker-compose.yml'
|
|
2248
2184
|
|
|
2249
|
-
|
|
2250
|
-
"
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
execute_command cmd
|
|
2185
|
+
if File.exists? 'deploy/build_qa_artifact'
|
|
2186
|
+
execute_command "deploy/build_qa_artifact"
|
|
2187
|
+
else
|
|
2188
|
+
[
|
|
2189
|
+
"if echo `docker network ls` | grep crash_default; \
|
|
2190
|
+
then echo 'crash_default network already existing'; \
|
|
2191
|
+
else docker network create crash_default; fi",
|
|
2192
|
+
'docker-compose build web',"docker-compose run --rm -w $PWD -u root -e MIX_ENV=qa --entrypoint /bin/sh web \
|
|
2193
|
+
'-c' 'mix local.hex --force && mix hex.info && \
|
|
2194
|
+
mix deps.get && mix compile && mix deps.compile && \
|
|
2195
|
+
mix phx.digest && \
|
|
2196
|
+
MIX_ENV=dev mix compile.sms && \
|
|
2197
|
+
MIX_ENV=dev mix compile.html && \
|
|
2198
|
+
MIX_ENV=dev mix compile.heml && \
|
|
2199
|
+
MIX_ENV=dev mix compile.app_notification && \
|
|
2200
|
+
rm -rf _build/qa/rel/ && \
|
|
2201
|
+
mix release --env=qa'"
|
|
2202
|
+
].each do |cmd|
|
|
2203
|
+
execute_command cmd
|
|
2204
|
+
end
|
|
2270
2205
|
end
|
|
2271
2206
|
|
|
2272
2207
|
cleanup_containers
|
|
@@ -2707,9 +2642,10 @@ class Release
|
|
|
2707
2642
|
end
|
|
2708
2643
|
|
|
2709
2644
|
def deploy_starsky_hutch?
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2645
|
+
true
|
|
2646
|
+
#starsky_present = !@projects['starsky'].nil? && !@projects['starsky'].empty? && @projects['starsky']['name'] != 'master' && !@projects['starsky']['default_branch']
|
|
2647
|
+
#hutch_present = !@projects['hutch'].nil? && !@projects['hutch'].empty? && @projects['hutch']['name'] != 'master' && !@projects['hutch']['default_branch']
|
|
2648
|
+
#starsky_present || hutch_present
|
|
2713
2649
|
end
|
|
2714
2650
|
|
|
2715
2651
|
def get_pyxis_version(deploy_id)
|
|
@@ -2925,36 +2861,40 @@ class Release
|
|
|
2925
2861
|
(Time.now.to_i.to_s[-4..-1].to_i + Random.rand(40000)).to_s
|
|
2926
2862
|
end
|
|
2927
2863
|
|
|
2928
|
-
def
|
|
2929
|
-
resp = describe_stack_resource('batch-job-
|
|
2864
|
+
def launch_mimo(env_hash)
|
|
2865
|
+
resp = describe_stack_resource('batch-job-mimo', 'JobDefinition')
|
|
2930
2866
|
|
|
2931
2867
|
@batch.submit_job({
|
|
2932
|
-
job_name: "
|
|
2868
|
+
job_name: "mimo-#{@dns_record_identifier}", # required
|
|
2933
2869
|
job_queue: "tools-production", # required
|
|
2934
2870
|
job_definition: resp.stack_resource_detail.physical_resource_id, # required
|
|
2935
2871
|
container_overrides: {
|
|
2936
2872
|
environment: [
|
|
2937
2873
|
{
|
|
2938
|
-
name: '
|
|
2939
|
-
value:
|
|
2874
|
+
name: 'ENV_HASH',
|
|
2875
|
+
value: env_hash
|
|
2940
2876
|
},
|
|
2941
2877
|
{
|
|
2942
|
-
name: '
|
|
2943
|
-
value:
|
|
2878
|
+
name: 'APP_ENV',
|
|
2879
|
+
value: 'qa'
|
|
2880
|
+
},
|
|
2881
|
+
{
|
|
2882
|
+
name: 'CYPRESS_BASE_URL',
|
|
2883
|
+
value: "https://hutch-#{env_hash}.qa.colaster.com"
|
|
2944
2884
|
},
|
|
2945
2885
|
{
|
|
2946
|
-
name: '
|
|
2947
|
-
value:
|
|
2886
|
+
name: 'CYPRESS_PEANO_BASE_URL',
|
|
2887
|
+
value: "http://peano-#{env_hash}.qa.colaster.com:10039/quotation"
|
|
2948
2888
|
},
|
|
2949
2889
|
{
|
|
2950
|
-
name: '
|
|
2951
|
-
value:
|
|
2890
|
+
name: 'QA_NAME',
|
|
2891
|
+
value: @git_branch
|
|
2952
2892
|
}
|
|
2953
2893
|
]
|
|
2954
2894
|
}
|
|
2955
2895
|
})
|
|
2956
2896
|
|
|
2957
|
-
output "
|
|
2897
|
+
output "Mimo lanciato con successo!\n".green
|
|
2958
2898
|
end
|
|
2959
2899
|
|
|
2960
2900
|
def get_currently_deployed_version(stack_name)
|
data/bin/twig-update-ami
CHANGED
|
@@ -29,8 +29,8 @@ class TwigUpdateAmi
|
|
|
29
29
|
Dir.chdir 'ami'
|
|
30
30
|
update_instance_name(ami_id, ami_name, ami_description, ami_template)
|
|
31
31
|
output 'running packer update (this could take some time)'.light_green
|
|
32
|
-
new_ami_id = update_packer(ami_template)
|
|
33
|
-
# new_ami_id = 'ami-
|
|
32
|
+
new_ami_id = update_packer(ami_template, env)
|
|
33
|
+
# new_ami_id = 'ami-0278219494e19b969'
|
|
34
34
|
Dir.chdir '..'
|
|
35
35
|
stop_if(new_ami_id.to_s.empty?, 'Failed to generate AMI!'.red)
|
|
36
36
|
output "new ami id: #{new_ami_id}"
|
|
@@ -50,33 +50,28 @@ class TwigUpdateAmi
|
|
|
50
50
|
if stack.include?('qa')
|
|
51
51
|
output "skipping stack #{stack} because is a qa"
|
|
52
52
|
next
|
|
53
|
-
|
|
54
|
-
stack_parameters = update_stack_parameters(get_stack_parameters(stack),
|
|
55
|
-
[
|
|
56
|
-
{ parameter_key: 'AMIID', parameter_value: new_ami_id }
|
|
57
|
-
]
|
|
58
|
-
)
|
|
59
|
-
update_stack(stack, get_stack_template(stack), stack_parameters)
|
|
60
|
-
elsif stack.include?('fleet')
|
|
53
|
+
else
|
|
61
54
|
stack_tags = tags_to_hashes(get_stack_tags(stack))
|
|
62
55
|
stack_tags['TemplateVersion'] = stack_tags['TemplateVersion'].to_i + 1
|
|
63
56
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
57
|
+
if stack.include?('batch')
|
|
58
|
+
stack_parameters = update_stack_parameters(get_stack_parameters(stack),
|
|
59
|
+
[
|
|
60
|
+
{ parameter_key: 'AMIID', parameter_value: new_ami_id },
|
|
61
|
+
{ parameter_key: 'TemplateVersion', parameter_value: stack_tags['TemplateVersion'].to_s }
|
|
62
|
+
]
|
|
63
|
+
)
|
|
64
|
+
else
|
|
65
|
+
stack_parameters = update_stack_parameters(get_stack_parameters(stack),
|
|
66
|
+
[
|
|
67
|
+
{ parameter_key: 'AMIID', parameter_value: new_ami_id },
|
|
68
|
+
{ parameter_key: 'DesiredCapacity', parameter_value: get_desired_capacity(stack).to_s },
|
|
69
|
+
{ parameter_key: 'TemplateVersion', parameter_value: stack_tags['TemplateVersion'].to_s }
|
|
70
|
+
]
|
|
71
|
+
)
|
|
72
|
+
end
|
|
73
|
+
|
|
71
74
|
update_stack(stack, get_stack_template(stack), stack_parameters, hashes_to_tags(stack_tags))
|
|
72
|
-
else # autoscaling group normali come ania-tools
|
|
73
|
-
stack_parameters = update_stack_parameters(get_stack_parameters(stack),
|
|
74
|
-
[
|
|
75
|
-
{ parameter_key: 'AMIID', parameter_value: new_ami_id },
|
|
76
|
-
{ parameter_key: 'DesiredCapacity', parameter_value: get_desired_capacity(stack).to_s }
|
|
77
|
-
]
|
|
78
|
-
)
|
|
79
|
-
update_stack(stack, get_stack_template(stack), stack_parameters)
|
|
80
75
|
end
|
|
81
76
|
end
|
|
82
77
|
|
|
@@ -149,8 +144,8 @@ class TwigUpdateAmi
|
|
|
149
144
|
end
|
|
150
145
|
end
|
|
151
146
|
|
|
152
|
-
def update_packer(json_filename)
|
|
153
|
-
execute_command "AWS_MAX_ATTEMPTS=90 AWS_POLL_DELAY_SECONDS=60 packer build -var datadog_apikey=`biscuit get -f ../configs/secrets/common.yml common_production_apikey_datadog` -var github_token=`biscuit get -f ../configs/secrets/common.yml common_private_repo_github_token` -var drone_key=\"`biscuit get -f ../configs/secrets/common.yml drone_license_key`\" -machine-readable ./#{json_filename} | tee build.log"
|
|
147
|
+
def update_packer(json_filename, env)
|
|
148
|
+
execute_command "AWS_MAX_ATTEMPTS=90 AWS_POLL_DELAY_SECONDS=60 packer build -var datadog_apikey=`biscuit get -f ../configs/secrets/common.yml common_production_apikey_datadog` -var github_token=`biscuit get -f ../configs/secrets/common.yml common_private_repo_github_token` -var drone_key=\"`biscuit get -f ../configs/secrets/common.yml drone_license_key`\" -var env=#{env} -machine-readable ./#{json_filename} | tee build.log"
|
|
154
149
|
`grep 'artifact,0,id' build.log | cut -d, -f6 | cut -d: -f2`.sub(/\n/, '')
|
|
155
150
|
end
|
|
156
151
|
|
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.62.
|
|
4
|
+
version: 0.62.15
|
|
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-03-
|
|
17
|
+
date: 2020-03-16 00:00:00.000000000 Z
|
|
18
18
|
dependencies:
|
|
19
19
|
- !ruby/object:Gem::Dependency
|
|
20
20
|
name: aws-sdk-autoscaling
|
|
@@ -326,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
326
326
|
- !ruby/object:Gem::Version
|
|
327
327
|
version: '0'
|
|
328
328
|
requirements: []
|
|
329
|
-
rubygems_version: 3.0.
|
|
329
|
+
rubygems_version: 3.0.3
|
|
330
330
|
signing_key:
|
|
331
331
|
specification_version: 4
|
|
332
332
|
summary: The Prima twig toolbelt
|