prima-twig 0.62.15 → 0.62.102
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 +1983 -0
- data/bin/twig-feature +15 -2191
- data/bin/twig-update-ami +9 -3
- data/lib/prima_aws_client.rb +23 -0
- data/lib/prima_twig.rb +3 -1
- metadata +6 -3
data/bin/twig-update-ami
CHANGED
@@ -30,10 +30,11 @@ class TwigUpdateAmi
|
|
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
32
|
new_ami_id = update_packer(ami_template, env)
|
33
|
-
# new_ami_id = 'ami-
|
33
|
+
# new_ami_id = 'ami-026890988d91ee8c6'
|
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}"
|
37
|
+
stop_if(true, "skipping stacks update")
|
37
38
|
|
38
39
|
output 'searching for ami to update...'
|
39
40
|
ami_mappings = JSON.parse(@s3.get_object(bucket: @s3_bucket, key: "ami/ami-mappings.json")["body"].read())
|
@@ -61,6 +62,11 @@ class TwigUpdateAmi
|
|
61
62
|
{ parameter_key: 'TemplateVersion', parameter_value: stack_tags['TemplateVersion'].to_s }
|
62
63
|
]
|
63
64
|
)
|
65
|
+
if stack.include?('offsite-backups')
|
66
|
+
stack_template = File.read("./cloudformation/stacks/batch/compute-environment-offsite-backups.yml")
|
67
|
+
else
|
68
|
+
stack_template = File.read("./cloudformation/stacks/batch/compute-environment.yml")
|
69
|
+
end
|
64
70
|
else
|
65
71
|
stack_parameters = update_stack_parameters(get_stack_parameters(stack),
|
66
72
|
[
|
@@ -69,9 +75,9 @@ class TwigUpdateAmi
|
|
69
75
|
{ parameter_key: 'TemplateVersion', parameter_value: stack_tags['TemplateVersion'].to_s }
|
70
76
|
]
|
71
77
|
)
|
78
|
+
stack_template = File.read("./cloudformation/stacks/asg/#{stack.to_s.split("/")[1]}.yml")
|
72
79
|
end
|
73
|
-
|
74
|
-
update_stack(stack, get_stack_template(stack), stack_parameters, hashes_to_tags(stack_tags))
|
80
|
+
update_stack(stack, stack_template, stack_parameters, hashes_to_tags(stack_tags))
|
75
81
|
end
|
76
82
|
end
|
77
83
|
|
data/lib/prima_aws_client.rb
CHANGED
@@ -337,6 +337,29 @@ module PrimaAwsClient
|
|
337
337
|
output "#{s3_bucket}/#{destination_path} uploadato con successo!\n".green
|
338
338
|
end
|
339
339
|
|
340
|
+
def wait_for_artifact(bucket, path)
|
341
|
+
ready = artifact_exists?(bucket, path)
|
342
|
+
sleep_seconds = 13
|
343
|
+
output "Attendo che lo sia pronto l'artefatto #{path}...\n".yellow
|
344
|
+
retries = 0
|
345
|
+
while !ready
|
346
|
+
ready = true if artifact_exists?(bucket, path)
|
347
|
+
seconds_elapsed = 0
|
348
|
+
loop do
|
349
|
+
break if seconds_elapsed >= sleep_seconds
|
350
|
+
print '.'.yellow; STDOUT.flush
|
351
|
+
sleep 1
|
352
|
+
seconds_elapsed += 1
|
353
|
+
end
|
354
|
+
retries += 1
|
355
|
+
if retries > 150
|
356
|
+
output "\n Timeout raggiunto aspettando #{path}\n".red
|
357
|
+
exit
|
358
|
+
end
|
359
|
+
end
|
360
|
+
output "\nArtefatto #{path} creato!\n".green
|
361
|
+
end
|
362
|
+
|
340
363
|
def list_import_stacks(export_name)
|
341
364
|
stacks = []
|
342
365
|
next_token = ''
|
data/lib/prima_twig.rb
CHANGED
@@ -20,7 +20,9 @@ class Prima
|
|
20
20
|
@twig = Twig.new(:read_options => true, :max_days_old => 30)
|
21
21
|
unless has_config?
|
22
22
|
if File.exist?('../prima/twig.yml')
|
23
|
-
|
23
|
+
`cp ../prima/twig.yml .`
|
24
|
+
elsif File.exist?('/tmp/twig.yml')
|
25
|
+
`cp /tmp/twig.yml .`
|
24
26
|
else
|
25
27
|
generate_config
|
26
28
|
end
|
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.102
|
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-05-25 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: aws-sdk-autoscaling
|
@@ -285,6 +285,7 @@ dependencies:
|
|
285
285
|
description: Our tools to manage git and github
|
286
286
|
email: matteo.giachino@prima.it
|
287
287
|
executables:
|
288
|
+
- twig-build
|
288
289
|
- twig-circle
|
289
290
|
- twig-deploy
|
290
291
|
- twig-feature
|
@@ -296,6 +297,7 @@ executables:
|
|
296
297
|
extensions: []
|
297
298
|
extra_rdoc_files: []
|
298
299
|
files:
|
300
|
+
- bin/twig-build
|
299
301
|
- bin/twig-circle
|
300
302
|
- bin/twig-deploy
|
301
303
|
- bin/twig-feature
|
@@ -326,7 +328,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
326
328
|
- !ruby/object:Gem::Version
|
327
329
|
version: '0'
|
328
330
|
requirements: []
|
329
|
-
|
331
|
+
rubyforge_project:
|
332
|
+
rubygems_version: 2.7.8
|
330
333
|
signing_key:
|
331
334
|
specification_version: 4
|
332
335
|
summary: The Prima twig toolbelt
|