rake_docker 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e3674a7b2cd6f279f83435aab1c4b8af38dc207
4
- data.tar.gz: 71b1f0919e623638154d3c3106dc66f28a3841c1
3
+ metadata.gz: 15b06409c03c10611901780de85a363a876ccbce
4
+ data.tar.gz: 7dacecfc4fd004f972c8618b75a7ba0418147c18
5
5
  SHA512:
6
- metadata.gz: 363475f69e80d9f97a602ccba11efef84b32c476d255072786682af2ccc93946eabc836980bc92511b3a5c86c8f228e39f10954d8616a9d29af7c859f600bbaa
7
- data.tar.gz: 1d6d929f4eaaca576ec5f9d5a221549aa93e21a53971bc0762ed132c4ef09f4d46bd89c0d12f2ac159692089324a80e0927d7523a69f65e0d2673f342f7c3fda
6
+ metadata.gz: 9fe41972b3bb07394b3c0b57decaae0419dc7c0dd460e7eb7ff16ddeeed9d04f0a1d1688bb0401ea87979934214277f6a725c071f7bec28318c4b131998121ed
7
+ data.tar.gz: de19fe671a6e22ace1b5b273f8bd8380187073937ad9a682bc6304f3d34768ab71cfefb19d381439815f006f42568d1fc90d8e753f4b3f02356454eb39dbeeb5
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rake_docker (0.6.0)
4
+ rake_docker (0.7.0)
5
+ aws-sdk (~> 2.10)
5
6
  docker-api (~> 1.33)
6
7
 
7
8
  GEM
@@ -12,6 +13,14 @@ GEM
12
13
  minitest (~> 5.1)
13
14
  thread_safe (~> 0.3, >= 0.3.4)
14
15
  tzinfo (~> 1.1)
16
+ aws-sdk (2.10.9)
17
+ aws-sdk-resources (= 2.10.9)
18
+ aws-sdk-core (2.10.9)
19
+ aws-sigv4 (~> 1.0)
20
+ jmespath (~> 1.0)
21
+ aws-sdk-resources (2.10.9)
22
+ aws-sdk-core (= 2.10.9)
23
+ aws-sigv4 (1.0.0)
15
24
  diff-lcs (1.3)
16
25
  docile (1.1.5)
17
26
  docker-api (1.33.6)
@@ -20,6 +29,7 @@ GEM
20
29
  excon (0.57.1)
21
30
  gem-release (0.7.4)
22
31
  i18n (0.8.4)
32
+ jmespath (1.3.1)
23
33
  json (2.1.0)
24
34
  memfs (1.0.0)
25
35
  minitest (5.10.2)
data/lib/rake_docker.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'rake_docker/version'
2
2
  require 'rake_docker/tasks'
3
+ require 'rake_docker/authentication'
3
4
 
4
5
  module RakeDocker
5
6
  end
@@ -0,0 +1 @@
1
+ require_relative 'authentication/ecr'
@@ -0,0 +1,36 @@
1
+ require 'aws-sdk'
2
+ require 'ostruct'
3
+
4
+ module RakeDocker
5
+ module Authentication
6
+ class ECR
7
+ def initialize &block
8
+ config = OpenStruct.new(
9
+ region: nil,
10
+ registry_id: nil)
11
+ block.call(*[config].slice(0, block.arity))
12
+
13
+ @ecr_client = Aws::ECR::Client.new(region: config.region)
14
+
15
+ @registry_id = config.registry_id.respond_to?(:call) ?
16
+ config.registry_id.call :
17
+ config.registry_id
18
+ end
19
+
20
+ def call
21
+ token_response = @ecr_client.get_authorization_token(
22
+ registry_ids: [@registry_id])
23
+ token_data = token_response.authorization_data[0]
24
+ proxy_endpoint = token_data.proxy_endpoint
25
+ email = 'none'
26
+ username, password =
27
+ Base64.decode64(token_data.authorization_token).split(':')
28
+
29
+ {
30
+ username: username, password: password, email: email,
31
+ serveraddress: proxy_endpoint
32
+ }
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,4 +1,5 @@
1
1
  require 'docker'
2
+ require 'ostruct'
2
3
  require_relative '../tasklib'
3
4
 
4
5
  module RakeDocker
@@ -19,12 +20,12 @@ module RakeDocker
19
20
  def define
20
21
  desc "Push #{image_name} image to repository"
21
22
  task name do
22
- params = OpenStruct.new({
23
+ params = OpenStruct.new(
23
24
  image_name: image_name,
24
25
  repository_url: repository_url,
25
26
  credentials: credentials,
26
27
  tag: tags
27
- })
28
+ )
28
29
 
29
30
  derived_repository_url = repository_url.respond_to?(:call) ?
30
31
  repository_url.call(*[params].slice(0, repository_url.arity)) :
@@ -1,4 +1,5 @@
1
1
  require 'docker'
2
+ require 'ostruct'
2
3
  require_relative '../tasklib'
3
4
 
4
5
  module RakeDocker
@@ -19,10 +20,10 @@ module RakeDocker
19
20
  def define
20
21
  desc "Tag #{image_name} image for repository"
21
22
  task name do
22
- params = OpenStruct.new({
23
+ params = OpenStruct.new(
23
24
  image_name: image_name,
24
25
  repository_name: repository_name
25
- })
26
+ )
26
27
 
27
28
  derived_repository_url = repository_url.respond_to?(:call) ?
28
29
  repository_url.call(*[params].slice(0, repository_url.arity)) :
@@ -1,3 +1,3 @@
1
1
  module RakeDocker
2
- VERSION = '0.6.0'
2
+ VERSION = '0.7.0'
3
3
  end
data/rake_docker.gemspec CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.required_ruby_version = '>= 2.0'
25
25
 
26
26
  spec.add_dependency 'docker-api', '~> 1.33'
27
+ spec.add_dependency 'aws-sdk', '~> 2.10'
27
28
 
28
29
  spec.add_development_dependency 'bundler', '~> 1.14'
29
30
  spec.add_development_dependency 'rake', '~> 10.0'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake_docker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toby Clemson
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.33'
27
+ - !ruby/object:Gem::Dependency
28
+ name: aws-sdk
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '2.10'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '2.10'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -142,6 +156,8 @@ files:
142
156
  - bin/console
143
157
  - bin/setup
144
158
  - lib/rake_docker.rb
159
+ - lib/rake_docker/authentication.rb
160
+ - lib/rake_docker/authentication/ecr.rb
145
161
  - lib/rake_docker/exceptions.rb
146
162
  - lib/rake_docker/tasklib.rb
147
163
  - lib/rake_docker/tasks.rb