dockistrano 0.0.2 → 0.0.3
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7ac28b523edaa71eb85020de59988f816994362d
|
|
4
|
+
data.tar.gz: e7caed84b3299f8824b2771cb521e20a3ab6770c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a641af2fa6076e1c3e5c72c69abd54e2b43c85d8addb2c5e0e430cda3744954107ac4d495354d7e42cc72b6c765ffbd966ce0f0d0fb9f18319fe3105c0e6d6cf
|
|
7
|
+
data.tar.gz: 8ec45003411aa01abfeb7ecf4bb5a93b3841f100362f18925c5aea5c623dc09896ef77f2eb7b82dfbbdf227378e1bec4f2a42f4b413a39175a93a3a3cfe60dd6
|
|
@@ -29,7 +29,7 @@ module Dockistrano
|
|
|
29
29
|
"backing_service_env" => config
|
|
30
30
|
})
|
|
31
31
|
|
|
32
|
-
backing_service.tag = tag_with_fallback(service.tag)
|
|
32
|
+
backing_service.tag = tag_with_fallback(service.registry, name, service.tag)
|
|
33
33
|
|
|
34
34
|
begin
|
|
35
35
|
loaded_config = load_config
|
|
@@ -89,10 +89,10 @@ module Dockistrano
|
|
|
89
89
|
class NoTagFoundForImage < StandardError
|
|
90
90
|
end
|
|
91
91
|
|
|
92
|
-
def tag_with_fallback(tag)
|
|
92
|
+
def tag_with_fallback(registry, image_name, tag)
|
|
93
93
|
fallback_tags = [tag, "develop", "master", "latest"]
|
|
94
94
|
|
|
95
|
-
available_tags = Docker.tags_for_image("#{
|
|
95
|
+
available_tags = Docker.tags_for_image("#{registry}/#{image_name}")
|
|
96
96
|
|
|
97
97
|
begin
|
|
98
98
|
tag_suggestion = fallback_tags.shift
|
|
@@ -102,7 +102,7 @@ module Dockistrano
|
|
|
102
102
|
if final_tag
|
|
103
103
|
final_tag
|
|
104
104
|
else
|
|
105
|
-
raise NoTagFoundForImage.new("No tag found for image #{
|
|
105
|
+
raise NoTagFoundForImage.new("No tag found for image #{image_name}, locally available tags: #{available_tags} `doc pull` for more tags from repository.")
|
|
106
106
|
end
|
|
107
107
|
end
|
|
108
108
|
|
data/lib/dockistrano/version.rb
CHANGED
|
@@ -37,7 +37,7 @@ describe Dockistrano::ServiceDependency do
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
it "sets the tag with a fallback" do
|
|
40
|
-
expect(subject).to receive(:tag_with_fallback).with("develop").and_return("latest")
|
|
40
|
+
expect(subject).to receive(:tag_with_fallback).with("my.registry.net", "postgresql", "develop").and_return("latest")
|
|
41
41
|
expect(subject.backing_service.tag).to eq("latest")
|
|
42
42
|
end
|
|
43
43
|
|
|
@@ -119,35 +119,29 @@ describe Dockistrano::ServiceDependency do
|
|
|
119
119
|
end
|
|
120
120
|
|
|
121
121
|
context "#tag_with_fallback" do
|
|
122
|
-
let(:backing_service) { double(registry: "registry", image_name: "postgresql") }
|
|
123
|
-
|
|
124
|
-
before do
|
|
125
|
-
allow(subject).to receive(:backing_service).and_return(backing_service)
|
|
126
|
-
end
|
|
127
|
-
|
|
128
122
|
it "returns the given tag when the tag is available" do
|
|
129
123
|
expect(Dockistrano::Docker).to receive(:tags_for_image).and_return(["feature-branch", "develop", "master", "latest"])
|
|
130
|
-
expect(subject.tag_with_fallback("feature-branch")).to eq("feature-branch")
|
|
124
|
+
expect(subject.tag_with_fallback("registry", "postgresql", "feature-branch")).to eq("feature-branch")
|
|
131
125
|
end
|
|
132
126
|
|
|
133
127
|
it "returns develop when the specific tag is not available" do
|
|
134
128
|
expect(Dockistrano::Docker).to receive(:tags_for_image).and_return(["develop", "master", "latest"])
|
|
135
|
-
expect(subject.tag_with_fallback("feature-branch")).to eq("develop")
|
|
129
|
+
expect(subject.tag_with_fallback("registry", "postgresql", "feature-branch")).to eq("develop")
|
|
136
130
|
end
|
|
137
131
|
|
|
138
132
|
it "returns master when develop is not available" do
|
|
139
133
|
expect(Dockistrano::Docker).to receive(:tags_for_image).and_return(["master", "latest"])
|
|
140
|
-
expect(subject.tag_with_fallback("feature-branch")).to eq("master")
|
|
134
|
+
expect(subject.tag_with_fallback("registry", "postgresql", "feature-branch")).to eq("master")
|
|
141
135
|
end
|
|
142
136
|
|
|
143
137
|
it "returns latest when master is not available" do
|
|
144
138
|
expect(Dockistrano::Docker).to receive(:tags_for_image).and_return(["latest"])
|
|
145
|
-
expect(subject.tag_with_fallback("feature-branch")).to eq("latest")
|
|
139
|
+
expect(subject.tag_with_fallback("registry", "postgresql", "feature-branch")).to eq("latest")
|
|
146
140
|
end
|
|
147
141
|
|
|
148
142
|
it "raises an error when not appropriate tag is found" do
|
|
149
143
|
expect(Dockistrano::Docker).to receive(:tags_for_image).and_return(["another-feature-branch"])
|
|
150
|
-
expect { subject.tag_with_fallback("feature-branch") }.to raise_error(Dockistrano::ServiceDependency::NoTagFoundForImage)
|
|
144
|
+
expect { subject.tag_with_fallback("registry", "postgresql", "feature-branch") }.to raise_error(Dockistrano::ServiceDependency::NoTagFoundForImage)
|
|
151
145
|
end
|
|
152
146
|
end
|
|
153
147
|
|