dockly 2.6.0 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dockly/docker.rb +13 -4
- data/lib/dockly/history.rb +1 -1
- data/lib/dockly/rake_task.rb +13 -16
- data/lib/dockly/version.rb +1 -1
- data/spec/dockly/docker_spec.rb +13 -0
- metadata +2 -2
data/lib/dockly/docker.rb
CHANGED
@@ -168,10 +168,19 @@ class Dockly::Docker
|
|
168
168
|
end
|
169
169
|
|
170
170
|
def import_base(docker_tar)
|
171
|
-
|
172
|
-
|
173
|
-
info "imported
|
174
|
-
image
|
171
|
+
repo = "#{name}-base"
|
172
|
+
tag = "dockly-#{Dockly::VERSION}-#{File.basename(docker_tar).split('.').first}"
|
173
|
+
info "looking for imported base image with tag: #{tag}"
|
174
|
+
image = Docker::Image.all.find { |img| img.info['RepoTags'].include?("#{repo}:#{tag}") }
|
175
|
+
if image
|
176
|
+
info "found imported base image: #{image.id}"
|
177
|
+
image
|
178
|
+
else
|
179
|
+
info "could not find image with tag #{tag}, importing the docker image from #{docker_tar}"
|
180
|
+
image = ::Docker::Image.import(docker_tar, 'repo' => repo, 'tag' => tag)
|
181
|
+
info "imported initial docker image: #{image.id}"
|
182
|
+
image
|
183
|
+
end
|
175
184
|
end
|
176
185
|
|
177
186
|
def add_build_env(image)
|
data/lib/dockly/history.rb
CHANGED
@@ -8,7 +8,7 @@ module Dockly::History
|
|
8
8
|
TAG_PREFIX = 'dockly-'
|
9
9
|
|
10
10
|
def push_content_tag!
|
11
|
-
fail 'An SSH agent must be running to push the tag' if ENV['
|
11
|
+
fail 'An SSH agent must be running to push the tag' if ENV['SSH_AUTH_SOCK'].nil?
|
12
12
|
refs = ["refs/tags/#{content_tag}"]
|
13
13
|
repo.remotes.each do |remote|
|
14
14
|
username = remote.url.split('@').first
|
data/lib/dockly/rake_task.rb
CHANGED
@@ -78,11 +78,10 @@ namespace :dockly do
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
deb inst.name =>
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
]
|
81
|
+
deb inst.name => 'dockly:load' do |name|
|
82
|
+
inst.build
|
83
|
+
end
|
84
|
+
|
86
85
|
prepare_targets << "dockly:deb:prepare:#{inst.name}"
|
87
86
|
upload_targets << "dockly:deb:upload:#{inst.name}"
|
88
87
|
copy_targets << "dockly:deb:copy:#{inst.name}"
|
@@ -110,11 +109,10 @@ namespace :dockly do
|
|
110
109
|
end
|
111
110
|
end
|
112
111
|
|
113
|
-
rpm inst.name =>
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
]
|
112
|
+
rpm inst.name => 'dockly:load' do |name|
|
113
|
+
inst.build
|
114
|
+
end
|
115
|
+
|
118
116
|
prepare_targets << "dockly:rpm:prepare:#{inst.name}"
|
119
117
|
upload_targets << "dockly:rpm:upload:#{inst.name}"
|
120
118
|
copy_targets << "dockly:rpm:copy:#{inst.name}"
|
@@ -137,7 +135,7 @@ namespace :dockly do
|
|
137
135
|
end
|
138
136
|
|
139
137
|
namespace :upload do
|
140
|
-
|
138
|
+
docker inst.name => 'dockly:load' do
|
141
139
|
Thread.current[:rake_task] = inst.name
|
142
140
|
inst.export_only
|
143
141
|
end
|
@@ -150,11 +148,10 @@ namespace :dockly do
|
|
150
148
|
end
|
151
149
|
end
|
152
150
|
|
153
|
-
docker inst.name =>
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
]
|
151
|
+
docker inst.name => 'dockly:load' do
|
152
|
+
Thread.current[:rake_task] = inst.name
|
153
|
+
inst.generate!
|
154
|
+
end
|
158
155
|
|
159
156
|
# Docker image will be generated by 'dockly:deb:package'
|
160
157
|
unless inst.s3_bucket.nil?
|
data/lib/dockly/version.rb
CHANGED
data/spec/dockly/docker_spec.rb
CHANGED
@@ -85,6 +85,10 @@ describe Dockly::Docker do
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
images << subject.import_base(subject.ensure_tar(docker_file))
|
88
|
+
expect(Docker::Image.all).to be_any do |image|
|
89
|
+
image.info['RepoTags']
|
90
|
+
.include?("my-app-base:dockly-#{Dockly::VERSION}-docker-export-ubuntu-latest")
|
91
|
+
end
|
88
92
|
expect(images.last).to_not be_nil
|
89
93
|
expect(images.last.id).to_not be_nil
|
90
94
|
|
@@ -97,6 +101,15 @@ describe Dockly::Docker do
|
|
97
101
|
subject.export_image(images.last)
|
98
102
|
expect(File.exist?('build/docker/test_docker-image.tgz')).to be_true
|
99
103
|
end
|
104
|
+
|
105
|
+
context 'when the image has already been imported' do
|
106
|
+
before { images << subject.import_base(docker_file) }
|
107
|
+
|
108
|
+
it 'does not reimport the image' do
|
109
|
+
expect(Docker::Image).to_not receive(:import)
|
110
|
+
subject.import_base(docker_file)
|
111
|
+
end
|
112
|
+
end
|
100
113
|
end
|
101
114
|
|
102
115
|
describe '#fetch_import' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dockly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-07-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: clamp
|