cai-ecs-entrypoint 1.0.0 → 1.1.0
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/.ruby-version +1 -0
- data/Gemfile.lock +4 -22
- data/bin/ssm-entrypoint +32 -26
- data/lib/cai/ecs/entrypoint/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b95c711494fdbf456d3bee012a150a7fa86036c66d22b083b36d84e968861fbf
|
|
4
|
+
data.tar.gz: 793012dc89512c79e649a1be18cf8f3a9d9f6800e1a6e874ed349ed124696af1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ce1f26011bb2ed5658d22a92145a8f0732259e97e54bf15de28e4e6446e36b2b5015f063a67616c5e960f920db2a41dd4ea93dbe937d17f569f24f567718a579
|
|
7
|
+
data.tar.gz: 182282dd0143a7c72c2ef222ef992e10148b2f547ae8985d155458a44ab2296d0f9b01fccdd4e1639d237d76f299b2d6c1adda4057d38a85226a2e0f4a98739b
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.5.3
|
data/Gemfile.lock
CHANGED
|
@@ -1,48 +1,30 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
cai-ecs-entrypoint (
|
|
4
|
+
cai-ecs-entrypoint (1.1.0)
|
|
5
5
|
aws-sdk-ssm (~> 1)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
10
|
aws-eventstream (1.0.1)
|
|
11
|
-
aws-partitions (1.
|
|
12
|
-
aws-sdk-core (3.
|
|
11
|
+
aws-partitions (1.140.0)
|
|
12
|
+
aws-sdk-core (3.46.2)
|
|
13
13
|
aws-eventstream (~> 1.0)
|
|
14
14
|
aws-partitions (~> 1.0)
|
|
15
15
|
aws-sigv4 (~> 1.0)
|
|
16
16
|
jmespath (~> 1.0)
|
|
17
|
-
aws-sdk-ssm (1.
|
|
17
|
+
aws-sdk-ssm (1.36.0)
|
|
18
18
|
aws-sdk-core (~> 3, >= 3.39.0)
|
|
19
19
|
aws-sigv4 (~> 1.0)
|
|
20
20
|
aws-sigv4 (1.0.3)
|
|
21
|
-
diff-lcs (1.3)
|
|
22
21
|
jmespath (1.4.0)
|
|
23
|
-
rake (10.5.0)
|
|
24
|
-
rspec (3.8.0)
|
|
25
|
-
rspec-core (~> 3.8.0)
|
|
26
|
-
rspec-expectations (~> 3.8.0)
|
|
27
|
-
rspec-mocks (~> 3.8.0)
|
|
28
|
-
rspec-core (3.8.0)
|
|
29
|
-
rspec-support (~> 3.8.0)
|
|
30
|
-
rspec-expectations (3.8.2)
|
|
31
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
32
|
-
rspec-support (~> 3.8.0)
|
|
33
|
-
rspec-mocks (3.8.0)
|
|
34
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
35
|
-
rspec-support (~> 3.8.0)
|
|
36
|
-
rspec-support (3.8.0)
|
|
37
22
|
|
|
38
23
|
PLATFORMS
|
|
39
24
|
ruby
|
|
40
25
|
|
|
41
26
|
DEPENDENCIES
|
|
42
|
-
bundler (~> 1.16)
|
|
43
27
|
cai-ecs-entrypoint!
|
|
44
|
-
rake (~> 10.0)
|
|
45
|
-
rspec (~> 3.0)
|
|
46
28
|
|
|
47
29
|
BUNDLED WITH
|
|
48
30
|
1.16.6
|
data/bin/ssm-entrypoint
CHANGED
|
@@ -1,35 +1,41 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
-
require 'aws-sdk-ssm'
|
|
4
|
-
|
|
5
3
|
env = {}
|
|
6
|
-
puts 'Injecting application secrets...'
|
|
7
|
-
|
|
8
|
-
begin
|
|
9
|
-
client = Aws::SSM::Client.new
|
|
10
|
-
|
|
11
|
-
next_token = nil
|
|
12
|
-
loop do
|
|
13
|
-
secrets = client.get_parameters_by_path(
|
|
14
|
-
path: ENV.fetch('SSM_KEY_PATH'),
|
|
15
|
-
with_decryption: true,
|
|
16
|
-
next_token: next_token
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
secrets.parameters.map do |parameter|
|
|
20
|
-
key = parameter.name.split('/').last
|
|
21
|
-
value = parameter.value
|
|
22
|
-
env[key] = value
|
|
23
|
-
end
|
|
24
4
|
|
|
25
|
-
|
|
26
|
-
|
|
5
|
+
if ENV.has_key?('SSM_KEY_PATH')
|
|
6
|
+
require 'aws-sdk-ssm'
|
|
7
|
+
|
|
8
|
+
puts 'Injecting application secrets...'
|
|
9
|
+
|
|
10
|
+
begin
|
|
11
|
+
client = Aws::SSM::Client.new
|
|
27
12
|
|
|
28
|
-
|
|
13
|
+
next_token = nil
|
|
14
|
+
loop do
|
|
15
|
+
secrets = client.get_parameters_by_path(
|
|
16
|
+
path: ENV.fetch('SSM_KEY_PATH'),
|
|
17
|
+
with_decryption: true,
|
|
18
|
+
next_token: next_token
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
secrets.parameters.map do |parameter|
|
|
22
|
+
key = parameter.name.split('/').last
|
|
23
|
+
value = parameter.value
|
|
24
|
+
env[key] = value
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
next_token = secrets.next_token
|
|
28
|
+
break unless next_token
|
|
29
|
+
|
|
30
|
+
sleep 1 # don't overrun the API rate limit
|
|
31
|
+
end
|
|
32
|
+
rescue Aws::Errors::MissingRegionError
|
|
33
|
+
puts 'Error: Missing AWS Region'
|
|
34
|
+
exit 1
|
|
35
|
+
rescue Aws::Errors::MissingCredentialsError
|
|
36
|
+
puts 'Error: Missing AWS Credentials'
|
|
37
|
+
exit 2
|
|
29
38
|
end
|
|
30
|
-
rescue Aws::Errors::MissingRegionError
|
|
31
|
-
puts 'ERROR! Unable to fetch SSM parameters!'
|
|
32
|
-
puts 'In production environments, this should fail startup!'
|
|
33
39
|
end
|
|
34
40
|
|
|
35
41
|
exec env, *ARGV
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cai-ecs-entrypoint
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jarrod Carlson
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2019-02-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: aws-sdk-ssm
|
|
@@ -33,6 +33,7 @@ extensions: []
|
|
|
33
33
|
extra_rdoc_files: []
|
|
34
34
|
files:
|
|
35
35
|
- ".gitignore"
|
|
36
|
+
- ".ruby-version"
|
|
36
37
|
- Gemfile
|
|
37
38
|
- Gemfile.lock
|
|
38
39
|
- README.md
|