odania_ops 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/odania_ops/helper/aws.rb +13 -0
- data/lib/odania_ops/helper/docker.rb +8 -1
- data/lib/odania_ops/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c49234f401d609315c8dcbed9a7181cc0bac15a
|
4
|
+
data.tar.gz: 5173213e749c30403b67d2c51afd3039d31f2816
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 593cea80ed7842f17623fa279d419e5df34d00984b86fae7e877bd5650e79f369a5683680d4684f62fb8bd7f212b2c44cd070c4ad2e975504376e5f47b046b3f
|
7
|
+
data.tar.gz: 8a5bab7358c5408bfa8ed617322a442dc5b15cbfc48a7c9f7cbb4b928f355a5cd471b04141cb9f9f06544b03f07344ad8f0e26c5f87a796c3049809e23514cd3
|
data/Gemfile.lock
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'aws-sdk'
|
2
|
+
require 'base64'
|
2
3
|
|
3
4
|
module OdaniaOps
|
4
5
|
module Helper
|
@@ -28,6 +29,18 @@ module OdaniaOps
|
|
28
29
|
|
29
30
|
result.uniq
|
30
31
|
end
|
32
|
+
|
33
|
+
def docker_login
|
34
|
+
client = ::Aws::ECR::Client.new(
|
35
|
+
{
|
36
|
+
region: $config['aws']['region'],
|
37
|
+
credentials: ::Aws::Credentials.new($config['aws']['access_key_id'], $config['aws']['secret_access_key'])
|
38
|
+
}
|
39
|
+
)
|
40
|
+
|
41
|
+
response = client.get_authorization_token
|
42
|
+
return Base64.decode64(response.authorization_data[0].authorization_token).split(':')
|
43
|
+
end
|
31
44
|
end
|
32
45
|
end
|
33
46
|
end
|
@@ -24,8 +24,15 @@ module OdaniaOps
|
|
24
24
|
data = $config['docker']
|
25
25
|
return if data['no_login']
|
26
26
|
|
27
|
+
if $config['docker']['use_aws']
|
28
|
+
username, password = OdaniaOps::Helper::Aws.docker_login
|
29
|
+
else
|
30
|
+
username = data['user']
|
31
|
+
password = data['password']
|
32
|
+
end
|
33
|
+
|
27
34
|
$logger.info "Login in to private registry #{registry_name}"
|
28
|
-
OdaniaOps::Helper::Shell.execute("docker login --username=#{
|
35
|
+
OdaniaOps::Helper::Shell.execute("docker login --username=#{username} --password=\"#{password}\" #{registry_url}")
|
29
36
|
end
|
30
37
|
|
31
38
|
def registry_name
|
data/lib/odania_ops/version.rb
CHANGED