prima-twig 1.2.4 → 1.2.6
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-update-ami +14 -4
- data/lib/prima_twig.rb +2 -2
- 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: 665845adb115e9091a4d63673e3386d7b50e2043350ee342daee36122a6807f1
|
4
|
+
data.tar.gz: d92dc143955f44ae455eb20bead9668737183bfab7fa7f62c9b116e279c9538e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27bcc7a32bc312e359015843c05ad59872d54582ce342587894489407a6c48dbbce6997a7cbc5be2e7d246aead9dc0f235996658e450810e4409b829a670428a
|
7
|
+
data.tar.gz: 2474944753cd11b793107b6b8de274e7460ea2f54a2587ee43f3bef89ca2ef2278b40f861e5198a79c4fb8acce32a1e14c6bc684b479e0a5b188417b2c939462
|
data/bin/twig-update-ami
CHANGED
@@ -29,14 +29,24 @@ 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
|
-
|
32
|
+
ami_mappings = JSON.parse(@s3.get_object(bucket: @s3_bucket, key: "ami/ami-mappings.json")["body"].read())
|
33
|
+
|
34
|
+
ami_mapping = nil
|
35
|
+
ami_mappings.each do |item|
|
36
|
+
if item['ami_template'].eql?(ami_template) and item['env'].eql?(env)
|
37
|
+
ami_mapping = item
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
stop_if(ami_mapping == nil, "No AMI found with parameters #{ami_template} and #{env}")
|
42
|
+
|
43
|
+
new_ami_id = update_packer(ami_template, env, ami_mapping['teams_mapping'], ami_mapping['country'])
|
33
44
|
# new_ami_id = 'ami-0d8488b68731e8756'
|
34
45
|
Dir.chdir '..'
|
35
46
|
stop_if(new_ami_id.to_s.empty?, 'Failed to generate AMI!'.red)
|
36
47
|
output "new ami id: #{new_ami_id}"
|
37
48
|
|
38
49
|
output 'searching for ami to update...'
|
39
|
-
ami_mappings = JSON.parse(@s3.get_object(bucket: @s3_bucket, key: "ami/ami-mappings.json")["body"].read())
|
40
50
|
old_amis = update_ami_mappings(ami_mappings, ami_template, env, new_ami_id)
|
41
51
|
stop_if(old_amis.empty?, "No ami to update! No #{ami_template} in env #{env}, exiting".yellow)
|
42
52
|
|
@@ -137,8 +147,8 @@ class TwigUpdateAmi
|
|
137
147
|
end
|
138
148
|
end
|
139
149
|
|
140
|
-
def update_packer(json_filename, env)
|
141
|
-
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"
|
150
|
+
def update_packer(json_filename, env, teams, country)
|
151
|
+
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} -var teams_mapping=#{teams} -var country=#{country} -machine-readable ./#{json_filename} | tee build.log"
|
142
152
|
`grep 'artifact,0,id' build.log | cut -d, -f6 | cut -d: -f2`.sub(/\n/, '')
|
143
153
|
end
|
144
154
|
|
data/lib/prima_twig.rb
CHANGED
@@ -8,8 +8,8 @@ require 'aws-sdk-core'
|
|
8
8
|
require 'rubyflare'
|
9
9
|
|
10
10
|
class Prima
|
11
|
-
CONFIG_KEYS=['github', 'cloudflare_email', 'cloudflare_apikey'
|
12
|
-
attr_reader :gh, :twig, :config, :rugged
|
11
|
+
CONFIG_KEYS=['github', 'cloudflare_email', 'cloudflare_apikey']
|
12
|
+
attr_reader :gh, :twig, :config, :rugged
|
13
13
|
|
14
14
|
def initialize
|
15
15
|
@twig = Twig.new(:read_options => true, :max_days_old => 30)
|
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.2.
|
4
|
+
version: 1.2.6
|
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-10-21 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: aws-sdk-autoscaling
|
@@ -314,7 +314,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
314
314
|
- !ruby/object:Gem::Version
|
315
315
|
version: '0'
|
316
316
|
requirements: []
|
317
|
-
rubygems_version: 3.0.
|
317
|
+
rubygems_version: 3.0.1
|
318
318
|
signing_key:
|
319
319
|
specification_version: 4
|
320
320
|
summary: The Prima twig toolbelt
|