kumo_dockercloud 3.5.1 → 3.5.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bd37c3774cc85c39d59e0f257b5ca1ce8f3ed2a
|
4
|
+
data.tar.gz: 7e11bf779b5e49a899ea426c63a2a60bb51b558c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6aa4ca4c6c1ef8599b1ae471c2c9190052ef92b5eb07f15fa23b003f26f395a6f2736d6dd490d8d6ce74545ae79a115ffec4bf126b4eae714e84704e8a6316a
|
7
|
+
data.tar.gz: eaff3fe986ced41fb48f85bc56722029166f5a3aa0d236d202dd470b5b3ed29d2b8bd474e59c412410c4ef5e27b9b764a603c6563020af3bfaa0a199b60d31f4
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
# KumoDockerCloud
|
1
|
+
# KumoDockerCloud
|
2
|
+
[![Build status](https://badge.buildkite.com/d22efc59148d48d86ca78e6129340070d1a459031a019fff48.svg)](https://buildkite.com/redbubble/kumo-dockercloud-gem) [![Code Climate](https://codeclimate.com/github/redbubble/kumo_dockercloud_gem/badges/gpa.svg)](https://codeclimate.com/github/redbubble/kumo_dockercloud_gem)
|
2
3
|
|
3
4
|
This is the Redbubble wrapper around creating environments in docker cloud. It is built into our rbdevltools container and can then be used during `apply-env` and `deploy` tasks.
|
4
5
|
|
@@ -21,9 +21,9 @@ module KumoDockerCloud
|
|
21
21
|
@stack_template_path = params.fetch(:stack_template_path)
|
22
22
|
@timeout = params.fetch(:timeout, 120)
|
23
23
|
@confirmation_timeout = params.fetch(:confirmation_timeout, 30)
|
24
|
-
|
25
24
|
@app_name = params.fetch(:app_name)
|
26
25
|
@config = EnvironmentConfig.new(app_name: @app_name, env_name: @env_name, config_path: params.fetch(:config_path))
|
26
|
+
@stack = Stack.new(@app_name, @env_name)
|
27
27
|
end
|
28
28
|
|
29
29
|
def apply(stack_checker = StackChecker.new)
|
@@ -37,10 +37,8 @@ module KumoDockerCloud
|
|
37
37
|
|
38
38
|
run_command("docker-cloud stack redeploy #{stack_name}")
|
39
39
|
|
40
|
-
stack = Stack.new(@app_name, @env_name)
|
41
|
-
|
42
40
|
begin
|
43
|
-
stack_checker.verify(stack)
|
41
|
+
stack_checker.verify(@stack)
|
44
42
|
rescue StackCheckError
|
45
43
|
raise EnvironmentApplyError.new("The stack is not in the expected state.")
|
46
44
|
end
|
@@ -76,8 +74,7 @@ module KumoDockerCloud
|
|
76
74
|
end
|
77
75
|
|
78
76
|
def exists?
|
79
|
-
|
80
|
-
result.include?(stack_name)
|
77
|
+
@stack.exists?
|
81
78
|
end
|
82
79
|
|
83
80
|
def write_stack_config_file(stack_file_data)
|
@@ -19,6 +19,10 @@ module KumoDockerCloud
|
|
19
19
|
checker.verify(service)
|
20
20
|
end
|
21
21
|
|
22
|
+
def exists?
|
23
|
+
!docker_cloud_stack.nil?
|
24
|
+
end
|
25
|
+
|
22
26
|
def deploy_blue_green(service_names, version, checker = ServiceChecker.new)
|
23
27
|
haproxy_service = HaproxyService.new(@stack_name, docker_cloud_api)
|
24
28
|
|
@@ -70,5 +74,9 @@ module KumoDockerCloud
|
|
70
74
|
|
71
75
|
@docker_cloud_api ||= DockerCloudApi.new(dockercloud_api_options)
|
72
76
|
end
|
77
|
+
|
78
|
+
def docker_cloud_stack
|
79
|
+
@docker_cloud_stack ||= docker_cloud_api.stack_by_name(@stack_name)
|
80
|
+
end
|
73
81
|
end
|
74
82
|
end
|
@@ -19,27 +19,26 @@ describe KumoDockerCloud::Environment do
|
|
19
19
|
let(:full_stack_name) { "#{app_name}-test" }
|
20
20
|
let(:confirmation_timeout) { 0.5 }
|
21
21
|
let(:stack_template_path) { File.join(__dir__, '../fixtures/stack.yml.erb') }
|
22
|
-
|
22
|
+
let(:exists_param) { true }
|
23
23
|
let(:params) { {name: env_name, env_vars: env_vars, app_name: app_name, config_path: 'a path', stack_template_path: stack_template_path, confirmation_timeout: confirmation_timeout} }
|
24
|
+
let(:stack) { instance_double(KumoDockerCloud::Stack, :stack, exists?: exists_param, stack_name: full_stack_name) }
|
24
25
|
|
25
26
|
subject(:env) { described_class.new(params) }
|
26
27
|
|
27
28
|
before do
|
28
29
|
allow(KumoDockerCloud::EnvironmentConfig).to receive(:new).and_return(config)
|
29
30
|
allow(KumoDockerCloud::StackFile).to receive(:create_from_template).and_return(stack_file)
|
31
|
+
allow(KumoDockerCloud::Stack).to receive(:new).with(app_name, env_name).and_return(stack)
|
30
32
|
end
|
31
33
|
|
32
34
|
describe "#apply" do
|
33
35
|
subject { env.apply }
|
34
|
-
let(:stack) { {"#{full_stack_name}" => 'stack stuff'} }
|
35
36
|
let(:stack_checker) { instance_double(KumoDockerCloud::StackChecker, :stack_checker, verify: true) }
|
36
37
|
before do
|
37
38
|
allow(config).to receive(:image_tag).and_return('latest')
|
38
39
|
allow(env).to receive(:evaluate_command).and_return app_name
|
39
40
|
allow(env).to receive(:run_command)
|
40
41
|
allow(KumoDockerCloud::StackChecker).to receive(:new).and_return(stack_checker)
|
41
|
-
allow(KumoDockerCloud::Stack).to receive(:new).with(app_name, env_name).and_return(stack)
|
42
|
-
|
43
42
|
end
|
44
43
|
|
45
44
|
it "writes a stack file" do
|
@@ -48,10 +47,13 @@ describe KumoDockerCloud::Environment do
|
|
48
47
|
subject
|
49
48
|
end
|
50
49
|
|
51
|
-
|
52
|
-
|
50
|
+
context 'when the stack does not exist' do
|
51
|
+
let(:exists_param) { false }
|
52
|
+
it 'runs the stack command' do
|
53
|
+
expect(env).to receive(:run_command).with(%r{^docker-cloud stack create -f .* -n #{full_stack_name}$})
|
53
54
|
|
54
|
-
|
55
|
+
subject
|
56
|
+
end
|
55
57
|
end
|
56
58
|
|
57
59
|
it 'runs the redeploy command' do
|
@@ -133,6 +135,5 @@ describe KumoDockerCloud::Environment do
|
|
133
135
|
expect(KumoDockerCloud::ConsoleJockey).to receive(:get_confirmation).with(confirmation_timeout).and_return(false)
|
134
136
|
subject
|
135
137
|
end
|
136
|
-
|
137
138
|
end
|
138
139
|
end
|
@@ -200,4 +200,26 @@ describe KumoDockerCloud::Stack do
|
|
200
200
|
expect(subject).to eq([redbubble_service])
|
201
201
|
end
|
202
202
|
end
|
203
|
+
|
204
|
+
describe '#exists' do
|
205
|
+
subject { stack.exists? }
|
206
|
+
let(:docker_cloud_api) { instance_double(KumoDockerCloud::DockerCloudApi, stack_by_name: docker_cloud_stack) }
|
207
|
+
before do
|
208
|
+
allow(KumoDockerCloud::DockerCloudApi).to receive(:new).and_return docker_cloud_api
|
209
|
+
end
|
210
|
+
|
211
|
+
context 'when the stack exists in docker cloud' do
|
212
|
+
let(:docker_cloud_stack) { double(:docker_cloud_stack) }
|
213
|
+
it 'is true when the stack exists in docker cloud' do
|
214
|
+
expect(subject).to eq(true)
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
context 'when the stack does not exist in docker cloud' do
|
219
|
+
let(:docker_cloud_stack) { nil }
|
220
|
+
it 'is false when the stack does not exist in docker cloud' do
|
221
|
+
expect(subject).to eq(false)
|
222
|
+
end
|
223
|
+
end
|
224
|
+
end
|
203
225
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kumo_dockercloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Redbubble
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-08-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: httpi
|