rake_docker 0.5.0 → 0.6.0
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/rake_docker/tasks/push.rb +57 -0
- data/lib/rake_docker/tasks/tag.rb +10 -11
- data/lib/rake_docker/tasks.rb +2 -1
- data/lib/rake_docker/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e3674a7b2cd6f279f83435aab1c4b8af38dc207
|
4
|
+
data.tar.gz: 71b1f0919e623638154d3c3106dc66f28a3841c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 363475f69e80d9f97a602ccba11efef84b32c476d255072786682af2ccc93946eabc836980bc92511b3a5c86c8f228e39f10954d8616a9d29af7c859f600bbaa
|
7
|
+
data.tar.gz: 1d6d929f4eaaca576ec5f9d5a221549aa93e21a53971bc0762ed132c4ef09f4d46bd89c0d12f2ac159692089324a80e0927d7523a69f65e0d2673f342f7c3fda
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'docker'
|
2
|
+
require_relative '../tasklib'
|
3
|
+
|
4
|
+
module RakeDocker
|
5
|
+
module Tasks
|
6
|
+
class Push < TaskLib
|
7
|
+
parameter :name, :default => :push
|
8
|
+
|
9
|
+
parameter :image_name, :required => true
|
10
|
+
parameter :repository_url, :required => true
|
11
|
+
|
12
|
+
parameter :credentials
|
13
|
+
parameter :tags, :required => true
|
14
|
+
|
15
|
+
def process_arguments(args)
|
16
|
+
self.name = args[0] if args[0]
|
17
|
+
end
|
18
|
+
|
19
|
+
def define
|
20
|
+
desc "Push #{image_name} image to repository"
|
21
|
+
task name do
|
22
|
+
params = OpenStruct.new({
|
23
|
+
image_name: image_name,
|
24
|
+
repository_url: repository_url,
|
25
|
+
credentials: credentials,
|
26
|
+
tag: tags
|
27
|
+
})
|
28
|
+
|
29
|
+
derived_repository_url = repository_url.respond_to?(:call) ?
|
30
|
+
repository_url.call(*[params].slice(0, repository_url.arity)) :
|
31
|
+
repository_url
|
32
|
+
derived_credentials = credentials.respond_to?(:call) ?
|
33
|
+
credentials.call(*[params].slice(0, credentials.arity)) :
|
34
|
+
credentials
|
35
|
+
derived_tags = tags.respond_to?(:call) ?
|
36
|
+
tags.call(*[params].slice(0, tags.arity)) :
|
37
|
+
tags
|
38
|
+
|
39
|
+
Docker.authenticate!(derived_credentials) if derived_credentials
|
40
|
+
|
41
|
+
images = Docker::Image.all(filter: derived_repository_url)
|
42
|
+
if images.empty?
|
43
|
+
raise RakeDocker::ImageNotFound,
|
44
|
+
"No image found for repository: '#{derived_repository_url}'"
|
45
|
+
end
|
46
|
+
|
47
|
+
image = images.first
|
48
|
+
derived_tags.each do |tag|
|
49
|
+
image.push(nil, tag: tag) do |chunk|
|
50
|
+
$stdout.puts chunk
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -10,8 +10,7 @@ module RakeDocker
|
|
10
10
|
parameter :repository_name, :required => true
|
11
11
|
parameter :repository_url, :required => true
|
12
12
|
|
13
|
-
parameter :
|
14
|
-
parameter :tag_as_latest, :default => false
|
13
|
+
parameter :tags, :required => true
|
15
14
|
|
16
15
|
def process_arguments(args)
|
17
16
|
self.name = args[0] if args[0]
|
@@ -28,9 +27,9 @@ module RakeDocker
|
|
28
27
|
derived_repository_url = repository_url.respond_to?(:call) ?
|
29
28
|
repository_url.call(*[params].slice(0, repository_url.arity)) :
|
30
29
|
repository_url
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
derived_tags = tags.respond_to?(:call) ?
|
31
|
+
tags.call(*[params].slice(0, tags.arity)) :
|
32
|
+
tags
|
34
33
|
|
35
34
|
images = Docker::Image.all(filter: repository_name)
|
36
35
|
if images.empty?
|
@@ -39,12 +38,12 @@ module RakeDocker
|
|
39
38
|
end
|
40
39
|
|
41
40
|
image = images.first
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
41
|
+
|
42
|
+
derived_tags.each do |tag|
|
43
|
+
image.tag(repo: derived_repository_url,
|
44
|
+
tag: tag,
|
45
|
+
force: true)
|
46
|
+
end
|
48
47
|
end
|
49
48
|
end
|
50
49
|
end
|
data/lib/rake_docker/tasks.rb
CHANGED
data/lib/rake_docker/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake_docker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toby Clemson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docker-api
|
@@ -148,6 +148,7 @@ files:
|
|
148
148
|
- lib/rake_docker/tasks/build.rb
|
149
149
|
- lib/rake_docker/tasks/clean.rb
|
150
150
|
- lib/rake_docker/tasks/prepare.rb
|
151
|
+
- lib/rake_docker/tasks/push.rb
|
151
152
|
- lib/rake_docker/tasks/tag.rb
|
152
153
|
- lib/rake_docker/version.rb
|
153
154
|
- rake_docker.gemspec
|