prima-twig 0.39.21 → 0.39.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/bin/twig-feature +15 -12
- data/bin/twig-update-ami +45 -48
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9d79cb6c8547f4f27a6f6e170d3656cee4d7f6f11ebb7b2ee05e67d89099723f
|
4
|
+
data.tar.gz: 0f36d2b236d7505a38139b567493f8312d20b28dfd0ed5d0fbe9231e08a2847e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea59ec0200d64481f69071412c06b7a9a1dd1574924512e2772588bc41d53c460a5a29713d82d5aa57f11ed2fe04ae8f4b2217729c1eac631f272c5125918564
|
7
|
+
data.tar.gz: 39eed3b688c3cb5c38bd55786378ebaa5a90650bcd97115bdaa518898889db34c8b1df2ce9a82e5022f8e1b0c22f0a0d70798893cb5678664c0cd12092d5e2fb
|
data/bin/twig-feature
CHANGED
@@ -598,9 +598,9 @@ class Release
|
|
598
598
|
output "Stack ancora attivi: #{stacks_to_delete.length.to_s}. Attendo altri 10 secondi per eliminare il cluster ECS"
|
599
599
|
end
|
600
600
|
|
601
|
-
delete_stack(cluster_stack_name)
|
602
|
-
delete_stack(@base_stack_name_alb + env_hash[3..8])
|
603
|
-
delete_stack(@base_stack_name_alb_ws + env_hash[3..8])
|
601
|
+
delete_stack(cluster_stack_name) if stack_exists?(cluster_stack_name)
|
602
|
+
delete_stack(@base_stack_name_alb + env_hash[3..8]) if stack_exists?(@base_stack_name_alb + env_hash[3..8])
|
603
|
+
delete_stack(@base_stack_name_alb_ws + env_hash[3..8]) if stack_exists?(@base_stack_name_alb_ws + env_hash[3..8])
|
604
604
|
`git checkout master && git push origin --delete ${DRONE_BRANCH}`
|
605
605
|
output "Finito!".green
|
606
606
|
|
@@ -1932,7 +1932,7 @@ class Release
|
|
1932
1932
|
if minimal
|
1933
1933
|
[
|
1934
1934
|
'docker-compose build web',
|
1935
|
-
"docker-compose run -w $PWD -u root -e WS_ENDPOINT=#{ws_endpoint} -e GRAPHQL_ENDPOINT=#{frontend_endpoint} -e MIX_ENV=staging -e HOSTNAME_PATTERN=https://#{crash_qa_host} web \
|
1935
|
+
"docker-compose run -w $PWD -u root -e WS_ENDPOINT=#{ws_endpoint} -e GRAPHQL_ENDPOINT=#{frontend_endpoint} -e MIX_ENV=staging -e ENV_HASH=#{deploy_id} -e HOSTNAME_PATTERN=https://#{crash_qa_host} web \
|
1936
1936
|
'-c' 'sed -i \"s/crash-staging.prima.it/#{crash_qa_host}/g\" config/staging.exs && \
|
1937
1937
|
mix local.hex --force && mix hex.info && \
|
1938
1938
|
mix deps.get && \
|
@@ -1979,7 +1979,7 @@ class Release
|
|
1979
1979
|
[
|
1980
1980
|
'mv docker-compose-ci.yml docker-compose.yml',
|
1981
1981
|
'docker-compose build web',
|
1982
|
-
"docker-compose run -w $PWD -e WS_ENDPOINT=#{ws_endpoint} -e GRAPHQL_ENDPOINT=#{frontend_endpoint} -e MIX_ENV=qa web \
|
1982
|
+
"docker-compose run -w $PWD -e WS_ENDPOINT=#{ws_endpoint} -e GRAPHQL_ENDPOINT=#{frontend_endpoint} -e ENV_HASH=#{deploy_id} -e MIX_ENV=qa web \
|
1983
1983
|
'-c' 'sed -i \"s/web-qa-host/#{web_qa_host}/g\" config/qa.exs && \
|
1984
1984
|
sed -i \"s/crash-qa-host/#{crash_qa_host}/g\" config/qa.exs && \
|
1985
1985
|
mix local.hex --force && mix hex.info && \
|
@@ -2634,17 +2634,20 @@ class Release
|
|
2634
2634
|
end
|
2635
2635
|
|
2636
2636
|
def import_redis_crash(qa_ip_address)
|
2637
|
-
output "Importo
|
2637
|
+
output "Importo chiavi di Redis da staging\n".yellow
|
2638
2638
|
|
2639
|
+
prefixes = ['CODICI', 'fun_with_flags']
|
2639
2640
|
redis_qa = Redis.new(:url => "redis://#{qa_ip_address}:6379/10")
|
2640
|
-
|
2641
|
-
return unless redis_qa.keys('CODICI').empty?
|
2642
|
-
|
2643
2641
|
redis_staging = Redis.new(:url => 'redis://staging.cache-1.prima.it:6379/10')
|
2644
2642
|
|
2645
|
-
|
2646
|
-
|
2647
|
-
|
2643
|
+
prefixes.each do |prefix|
|
2644
|
+
redis_staging.keys("#{prefix}*").each do |key|
|
2645
|
+
next unless redis_qa.keys(key).empty?
|
2646
|
+
output "Importo #{key} dal Redis di staging\n".yellow
|
2647
|
+
dump_staging = redis_staging.dump key
|
2648
|
+
redis_qa.restore key, 0, dump_staging
|
2649
|
+
end
|
2650
|
+
end
|
2648
2651
|
end
|
2649
2652
|
|
2650
2653
|
def import_dbs(ip_address)
|
data/bin/twig-update-ami
CHANGED
@@ -15,67 +15,61 @@ class TwigUpdateAmi
|
|
15
15
|
exec "gem update prima-twig && twig update-ami #{ARGV.join ' '}" unless `gem outdated`.lines.grep(/^prima-twig \(.*\)/).empty?
|
16
16
|
@s3 = Aws::S3::Client.new
|
17
17
|
@s3_bucket = 'prima-deploy'
|
18
|
-
@
|
18
|
+
@instances_production = JSON.parse File.read('../twig-binaries/cloudformation_prod.json')
|
19
|
+
@instances_staging = JSON.parse File.read('../twig-binaries/cloudformation_staging.json')
|
19
20
|
end
|
20
21
|
|
21
22
|
def execute!(args)
|
22
23
|
if args[3] == 'staging'
|
23
|
-
update_amis args[0], args[1], args[2],
|
24
|
+
update_amis args[0], args[1], args[2], [@instances_staging]
|
24
25
|
else
|
25
|
-
update_amis args[0], args[1], args[2],
|
26
|
+
update_amis args[0], args[1], args[2], [@instances_production] #[@instances_staging, @instances_production]
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
29
30
|
private
|
30
31
|
|
31
|
-
def update_amis(ami_id, ami_name, ami_description,
|
32
|
-
|
33
|
-
|
34
|
-
output
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
stack_parameters = get_stack_parameters(stack['stack_name'])
|
56
|
-
stack_parameters.each do |param|
|
57
|
-
if param.parameter_key.eql?('DesiredCapacity')
|
58
|
-
desired_capacity = get_desired_capacity(stack['stack_name'])
|
59
|
-
desired_capacity.nil? ? break : param.parameter_value.sub!(/[0-9]+/, desired_capacity.to_s)
|
60
|
-
break
|
32
|
+
def update_amis(ami_id, ami_name, ami_description, instances)
|
33
|
+
instances.each do |instance_class|
|
34
|
+
instance_class['amis'].each do |ami|
|
35
|
+
output 'updating instance definition'.light_green
|
36
|
+
Dir.chdir 'ami'
|
37
|
+
update_instance_name(ami_id, ami_name, ami_description, ami['json'])
|
38
|
+
output 'running packer update (this could take some time)'.light_green
|
39
|
+
new_ami_id = update_packer ami['json']
|
40
|
+
Dir.chdir '..'
|
41
|
+
output 'new ami id: ' + new_ami_id
|
42
|
+
stop_if new_ami_id.to_s.empty?, 'Failed to generate AMI!'
|
43
|
+
ami['stacks'].each do |stack|
|
44
|
+
output 'updating ' + stack['yaml_filename'] + ' and copying onto s3'
|
45
|
+
update_yml_files(new_ami_id, stack['yaml_filename'])
|
46
|
+
copy_yml_files_to_s3(stack['yaml_filename'], stack['s3_key'])
|
47
|
+
output 'updating stack on cloudformation'
|
48
|
+
if stack['stack_name'] and stack_exists?(stack['stack_name'])
|
49
|
+
stack_parameters = get_stack_parameters(stack['stack_name'])
|
50
|
+
stack_parameters.each do |param|
|
51
|
+
if param.parameter_key.eql?('DesiredCapacity')
|
52
|
+
desired_capacity = get_desired_capacity(stack['stack_name'])
|
53
|
+
desired_capacity.nil? ? break : param.parameter_value.sub!(/[0-9]+/, desired_capacity.to_s)
|
54
|
+
break
|
55
|
+
end
|
61
56
|
end
|
57
|
+
update_stack_url(stack['stack_name'], stack['template_url'], stack_parameters)
|
58
|
+
else
|
59
|
+
output "skipping #{stack['yaml_filename']} because is not active on cloudformation"
|
62
60
|
end
|
63
|
-
update_stack_url(stack['stack_name'], stack['template_url'], stack_parameters)
|
64
61
|
end
|
65
|
-
end
|
66
62
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
end
|
72
|
-
ami['stacks'].each do |stack|
|
73
|
-
if only_staging and not stack['stack_name'].include?('allinone-staging')
|
74
|
-
output "skipping #{stack['stack_name']} because only_staging enabled".yellow
|
75
|
-
next
|
63
|
+
unless ami['batch_compute_environments'].nil?
|
64
|
+
ami['batch_compute_environments'].each do |ce|
|
65
|
+
update_batch_compute_environment(ce, new_ami_id)
|
66
|
+
end
|
76
67
|
end
|
77
|
-
|
78
|
-
|
68
|
+
|
69
|
+
ami['stacks'].each do |stack|
|
70
|
+
if stack['stack_name'] and stack_exists?(stack['stack_name'])
|
71
|
+
wait_for_stack_ready(stack['stack_name'], ['CREATE_FAILED', 'ROLLBACK_IN_PROGRESS', 'ROLLBACK_FAILED', 'DELETE_IN_PROGRESS', 'DELETE_FAILED', 'DELETE_COMPLETE', 'UPDATE_ROLLBACK_FAILED', 'UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS', 'UPDATE_ROLLBACK_COMPLETE', 'ROLLBACK_COMPLETE'])
|
72
|
+
end
|
79
73
|
end
|
80
74
|
end
|
81
75
|
end
|
@@ -112,9 +106,7 @@ class TwigUpdateAmi
|
|
112
106
|
|
113
107
|
def update_yml_files(ami_id, yaml_filename)
|
114
108
|
file_content = File.read yaml_filename
|
115
|
-
|
116
109
|
file_content.sub!(/ami-[0-9a-z]{8,17}/, ami_id)
|
117
|
-
|
118
110
|
File.open yaml_filename, 'w' do |f|
|
119
111
|
f.write file_content
|
120
112
|
end
|
@@ -179,6 +171,11 @@ class TwigUpdateAmi
|
|
179
171
|
wait_for_stack_ready(stack['stack_name'], ['CREATE_FAILED', 'ROLLBACK_IN_PROGRESS', 'ROLLBACK_FAILED', 'DELETE_IN_PROGRESS', 'DELETE_FAILED', 'DELETE_COMPLETE', 'UPDATE_ROLLBACK_FAILED', 'UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS', 'UPDATE_ROLLBACK_COMPLETE', 'ROLLBACK_COMPLETE'])
|
180
172
|
|
181
173
|
output "retrieving the list of stacks that are currently using the stack #{stack['stack_name']}"
|
174
|
+
if stack['stack_name'].include?('staging')
|
175
|
+
job_stacks = list_import_stacks old_ce_name + '-staging'
|
176
|
+
else
|
177
|
+
job_stacks = list_import_stacks old_ce_name + '-production'
|
178
|
+
end
|
182
179
|
job_stacks = list_import_stacks old_ce_name + '-production'
|
183
180
|
job_stacks.each do |job_stack_name|
|
184
181
|
output "updating the stack #{job_stack_name} to use to the new compute environment"
|
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.39.
|
4
|
+
version: 0.39.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matteo Giachino
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2018-
|
16
|
+
date: 2018-09-05 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: aws-sdk
|
@@ -214,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
214
|
version: '0'
|
215
215
|
requirements: []
|
216
216
|
rubyforge_project:
|
217
|
-
rubygems_version: 2.
|
217
|
+
rubygems_version: 2.7.7
|
218
218
|
signing_key:
|
219
219
|
specification_version: 4
|
220
220
|
summary: The Prima twig toolbelt
|