dockly 4.0.0 → 4.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 +5 -5
- data/lib/dockly/bash_builder.rb +1 -1
- data/lib/dockly/deb.rb +4 -2
- data/lib/dockly/docker.rb +5 -1
- data/lib/dockly/version.rb +1 -1
- data/snippets/docker_tag_latest.erb +1 -1
- data/spec/dockly/bash_builder_spec.rb +2 -2
- data/spec/dockly/docker_spec.rb +101 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0eb949e588205c02f1c15dbc3b609b7d14e3fd24
|
4
|
+
data.tar.gz: 52ab9c8916b071f0035400ced4c4fd73cf407885
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5ec4ce34a0bc5b270451dbd717988038a4ad3344e1a2f1d497a089cf287f3da1d8d3b940291575b8d69f75a9d00df685e36a1ec2cd9134e3d651d190f32dd75
|
7
|
+
data.tar.gz: 3400f1bf912778501d3b360d75a17d22e959ad68d1a5dee63bbfe9785d73bbb9a42fac4465486f8445469dbd6fd9f99b67c38be066edfd2f2dbd860d808d4ca9
|
data/lib/dockly/bash_builder.rb
CHANGED
@@ -26,6 +26,6 @@ module Dockly
|
|
26
26
|
generate_snippet_for :registry_import, [:repo, :tag], { :tag => "latest" }
|
27
27
|
generate_snippet_for :auth_ecr, [:server_address]
|
28
28
|
|
29
|
-
generate_snippet_for :docker_tag_latest, [:repo, :tag]
|
29
|
+
generate_snippet_for :docker_tag_latest, [:repo, :tag, :new_name]
|
30
30
|
end
|
31
31
|
end
|
data/lib/dockly/deb.rb
CHANGED
@@ -226,12 +226,13 @@ private
|
|
226
226
|
if registry.is_a?(Dockly::Docker::ECR)
|
227
227
|
scripts << bb.auth_ecr(registry.server_address)
|
228
228
|
end
|
229
|
+
|
229
230
|
scripts << bb.registry_import(docker.repo, docker.tag)
|
231
|
+
scripts << bb.docker_tag_latest(docker.repo, docker.tag, docker.name)
|
230
232
|
else
|
231
233
|
scripts += collect_non_registry_scripts(bb)
|
232
234
|
end
|
233
235
|
end
|
234
|
-
|
235
236
|
scripts.join("\n")
|
236
237
|
end
|
237
238
|
|
@@ -252,7 +253,8 @@ private
|
|
252
253
|
scripts << bb.s3_docker_import(docker.s3_url, docker.name, docker.tag)
|
253
254
|
end
|
254
255
|
end
|
255
|
-
|
256
|
+
|
257
|
+
scripts << bb.docker_tag_latest(docker.repo, docker.tag, docker.repo)
|
256
258
|
end
|
257
259
|
|
258
260
|
def add_startup_script(package, startup_script = "dockly-startup.sh")
|
data/lib/dockly/docker.rb
CHANGED
@@ -339,7 +339,11 @@ class Dockly::Docker
|
|
339
339
|
|
340
340
|
raise "Could not find image after authentication" if image.nil?
|
341
341
|
|
342
|
-
image.push(registry.to_h, :registry => registry.server_address)
|
342
|
+
image.push(registry.to_h, :registry => registry.server_address) do |resp|
|
343
|
+
if resp.include?('errorDetail')
|
344
|
+
raise "Error pushing to registry: #{resp}"
|
345
|
+
end
|
346
|
+
end
|
343
347
|
end
|
344
348
|
|
345
349
|
def fetch_import
|
data/lib/dockly/version.rb
CHANGED
@@ -32,8 +32,8 @@ describe Dockly::BashBuilder do
|
|
32
32
|
|
33
33
|
context "when there is a tag" do
|
34
34
|
it "tags the repo:tag as repo:latest" do
|
35
|
-
output = subject.docker_tag_latest("test_repo", "a_tag")
|
36
|
-
expect(output).to include("docker tag test_repo:a_tag test_repo:latest")
|
35
|
+
output = subject.docker_tag_latest("registry/test_repo", "a_tag", "test_repo")
|
36
|
+
expect(output).to include("docker tag registry/test_repo:a_tag test_repo:latest")
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
data/spec/dockly/docker_spec.rb
CHANGED
@@ -313,6 +313,107 @@ describe Dockly::Docker do
|
|
313
313
|
end
|
314
314
|
end
|
315
315
|
|
316
|
+
describe '#push_to_registry', :docker do
|
317
|
+
let(:image) { Docker::Image.create('fromImage' => 'ubuntu:14.04') }
|
318
|
+
let(:ecr) { double(:ecr) }
|
319
|
+
|
320
|
+
context 'when there is no registry' do
|
321
|
+
it 'raises' do
|
322
|
+
expect(subject.registry).to eq(nil)
|
323
|
+
|
324
|
+
expect { subject.push_to_registry(image) }.to raise_error(/No registry/)
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
328
|
+
context 'when there is a registry' do
|
329
|
+
before do
|
330
|
+
subject.instance_variable_set(:"@ecr", ecr)
|
331
|
+
|
332
|
+
allow(ecr)
|
333
|
+
.to receive(:server_address)
|
334
|
+
.and_return('server_address')
|
335
|
+
|
336
|
+
expect(subject.registry).to eq(ecr)
|
337
|
+
end
|
338
|
+
|
339
|
+
context "that can't be authenticated to" do
|
340
|
+
before do
|
341
|
+
allow(ecr)
|
342
|
+
.to receive(:authenticate!)
|
343
|
+
.and_raise
|
344
|
+
end
|
345
|
+
|
346
|
+
it 'raises' do
|
347
|
+
expect { subject.push_to_registry(image) }
|
348
|
+
.to raise_error(StandardError)
|
349
|
+
end
|
350
|
+
end
|
351
|
+
|
352
|
+
context 'that can be authenticated to' do
|
353
|
+
before do
|
354
|
+
allow(ecr).to receive(:authenticate!)
|
355
|
+
|
356
|
+
allow(Docker::Image)
|
357
|
+
.to receive(:all)
|
358
|
+
.with(all: true)
|
359
|
+
.and_return(available_images)
|
360
|
+
end
|
361
|
+
|
362
|
+
context "but the image isn't found" do
|
363
|
+
let(:available_images) { [] }
|
364
|
+
|
365
|
+
it 'raises' do
|
366
|
+
expect { subject.push_to_registry(image) }
|
367
|
+
.to raise_error(/Could not find image after authentication/)
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
context 'and the image is found' do
|
372
|
+
let(:available_images) { [image] }
|
373
|
+
|
374
|
+
before do
|
375
|
+
allow(ecr)
|
376
|
+
.to receive(:to_h)
|
377
|
+
.and_return({})
|
378
|
+
allow(image)
|
379
|
+
.to receive(:push)
|
380
|
+
.and_yield(push_message)
|
381
|
+
end
|
382
|
+
|
383
|
+
context 'but the push to the registry fails' do
|
384
|
+
let(:push_message) do
|
385
|
+
<<-EOF
|
386
|
+
{"errorDetail":{"message":"name unknown: The repository with name 'repository'
|
387
|
+
does not exist in the registry with id 'accoundid'"},"error":"name unknown:
|
388
|
+
The repository with name 'repository' does not exist in the registry with id 'accountid'"}
|
389
|
+
EOF
|
390
|
+
end
|
391
|
+
|
392
|
+
it 'raises' do
|
393
|
+
expect { subject.push_to_registry(image) }
|
394
|
+
.to raise_error(/Error pushing to registry/)
|
395
|
+
end
|
396
|
+
end
|
397
|
+
|
398
|
+
context 'and the push to the registry succeeds' do
|
399
|
+
let(:push_message) do
|
400
|
+
<<-EOF
|
401
|
+
{"status":"Pushed","progressDetail":{},"id":"id"}
|
402
|
+
{"status":"sha: digest: digest size: 2048"}
|
403
|
+
{"progressDetail":{},"aux":{"Tag":"sha","Digest":"digest","Size":2048}}
|
404
|
+
EOF
|
405
|
+
end
|
406
|
+
|
407
|
+
it 'passes' do
|
408
|
+
expect(subject.push_to_registry(image))
|
409
|
+
.not_to raise_error
|
410
|
+
end
|
411
|
+
end
|
412
|
+
end
|
413
|
+
end
|
414
|
+
end
|
415
|
+
end
|
416
|
+
|
316
417
|
describe '#export_image_diff', :docker do
|
317
418
|
let(:images) { [] }
|
318
419
|
let(:output) { StringIO.new }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dockly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Swipely, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|
@@ -326,7 +326,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
326
326
|
- !ruby/object:Gem::Version
|
327
327
|
version: '0'
|
328
328
|
requirements: []
|
329
|
-
|
329
|
+
rubyforge_project:
|
330
|
+
rubygems_version: 2.5.1
|
330
331
|
signing_key:
|
331
332
|
specification_version: 4
|
332
333
|
summary: Packaging made easy
|
@@ -356,3 +357,4 @@ test_files:
|
|
356
357
|
- spec/fixtures/test-2.tar.gz
|
357
358
|
- spec/fixtures/test-3.tar
|
358
359
|
- spec/spec_helper.rb
|
360
|
+
has_rdoc:
|