dpl 1.7.20.travis.951.4 → 1.7.20.travis.952.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/dpl/provider.rb +1 -1
- data/lib/dpl/provider/deis.rb +11 -60
- data/spec/provider/deis_spec.rb +15 -32
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YmY2YmUyZTkxZTM5ZjY0ZjlmZjhiMTE5MGZkYzc3YjRhNThmMzg5NQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDk3N2M3YTZiZGExZTM5NTJhZGEwNTIyNzVhNjA4OWJlZmIzM2Q5NQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjdjMWQxNmEzMDdiM2UwYTNhOTc0YjllOTUzYjBmZTA4ZGMwMTRjYzEwOWQ1
|
10
|
+
MTE2NDJiY2ZiYzIxMjJkNTQ2NjUwZmRmZWE4Yzc3MTYxM2RiZTM4OTg3MDAz
|
11
|
+
ZTllNmMwZTU2OWY2Nzk2YjJmNDhjZjcwZTA5MTBiOGJmMzdiODI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MWQzNmI1NWE0YWQ0YjEzNmU2NDIzNTVmNmUwMWRkYjUwN2QyYjZkY2FhZDVh
|
14
|
+
ZDM3MDgzNmQ5MmI0N2NhMTU5MTE4ODBkYWU1NjY3NjU2OWJmZjllNDIzOWE2
|
15
|
+
YTgyYTk0MDJkNmQ2Nzc0ZWFlOTQ4MDllODI0M2E3YjA0Y2NkNGI=
|
data/lib/dpl/provider.rb
CHANGED
@@ -196,7 +196,7 @@ module DPL
|
|
196
196
|
|
197
197
|
File.open(path, 'w') do |file|
|
198
198
|
file.write "#!/bin/sh\n"
|
199
|
-
file.write "exec ssh -o StrictHostKeychecking=no -o CheckHostIP=no -o UserKnownHostsFile=/dev/null -i #{key_path}
|
199
|
+
file.write "exec ssh -o StrictHostKeychecking=no -o CheckHostIP=no -o UserKnownHostsFile=/dev/null -i #{key_path} \"$@\"\n"
|
200
200
|
end
|
201
201
|
|
202
202
|
chmod(0740, path)
|
data/lib/dpl/provider/deis.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
module DPL
|
2
2
|
class Provider
|
3
3
|
class Deis < Provider
|
4
|
-
experimental 'Deis'
|
5
|
-
|
6
4
|
def install_deploy_dependencies
|
7
|
-
|
5
|
+
context.shell "curl -sSL http://deis.io/deis-cli/install.sh | sh -s #{option(:client_version)}"
|
8
6
|
end
|
9
7
|
|
10
8
|
def needs_key?
|
@@ -12,7 +10,7 @@ module DPL
|
|
12
10
|
end
|
13
11
|
|
14
12
|
def check_auth
|
15
|
-
unless context.shell "deis login #{
|
13
|
+
unless context.shell "./deis login #{option(:controller)}" \
|
16
14
|
" --username=#{option(:username)}" \
|
17
15
|
" --password=#{option(:password)}"
|
18
16
|
error 'Login failed.'
|
@@ -20,89 +18,42 @@ module DPL
|
|
20
18
|
end
|
21
19
|
|
22
20
|
def check_app
|
23
|
-
unless context.shell "deis apps:info --app=#{option(:app)}"
|
21
|
+
unless context.shell "./deis apps:info --app=#{option(:app)}"
|
24
22
|
error 'Application could not be verified.'
|
25
23
|
end
|
26
24
|
end
|
27
25
|
|
28
26
|
def setup_key(file)
|
29
|
-
unless context.shell "deis keys:add #{file}"
|
27
|
+
unless context.shell "./deis keys:add #{file}"
|
30
28
|
error 'Adding keys failed.'
|
31
29
|
end
|
32
30
|
end
|
33
31
|
|
34
32
|
def setup_git_ssh(path, key_path)
|
35
33
|
super(path, key_path)
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
# A git remote is required for running commands
|
41
|
-
# https://github.com/deis/deis/issues/1086
|
42
|
-
add_git_remote
|
34
|
+
|
35
|
+
unless context.shell "./deis git:remote --app=#{option(:app)}"
|
36
|
+
error 'Adding git remote failed.'
|
37
|
+
end
|
43
38
|
end
|
44
39
|
|
45
40
|
def remove_key
|
46
|
-
unless context.shell "deis keys:remove #{option(:key_name)}"
|
41
|
+
unless context.shell "./deis keys:remove #{option(:key_name)}"
|
47
42
|
error 'Removing keys failed.'
|
48
43
|
end
|
49
44
|
end
|
50
45
|
|
51
46
|
def push_app
|
52
|
-
|
53
|
-
unless context.shell "git push #{git_push_url} HEAD:refs/heads/master -f"
|
47
|
+
unless context.shell "git push deis HEAD:refs/heads/master -f"
|
54
48
|
error 'Deploying application failed.'
|
55
49
|
end
|
56
50
|
end
|
57
51
|
|
58
52
|
def run(command)
|
59
|
-
unless context.shell "deis
|
53
|
+
unless context.shell "deis run -- #{command}"
|
60
54
|
error 'Running command failed.'
|
61
55
|
end
|
62
56
|
end
|
63
|
-
|
64
|
-
private
|
65
|
-
|
66
|
-
def wait_until_key_is_set
|
67
|
-
sleep 5
|
68
|
-
end
|
69
|
-
|
70
|
-
def ssh_config_entry(key_file)
|
71
|
-
"\nHost deis-repo\n" \
|
72
|
-
" Hostname #{option(:controller)}\n" \
|
73
|
-
" Port 2222\n" \
|
74
|
-
" User git\n" \
|
75
|
-
" IdentityFile #{key_file}\n"
|
76
|
-
end
|
77
|
-
|
78
|
-
def add_ssh_config_entry(key_file)
|
79
|
-
FileUtils.mkdir_p(ssh_config_dir)
|
80
|
-
File.open(ssh_config, 'a') { |f| f.write(ssh_config_entry(key_file)) }
|
81
|
-
end
|
82
|
-
|
83
|
-
def ssh_config
|
84
|
-
File.join(ssh_config_dir, 'config')
|
85
|
-
end
|
86
|
-
|
87
|
-
def ssh_config_dir
|
88
|
-
File.join(Dir.home, '.ssh')
|
89
|
-
end
|
90
|
-
|
91
|
-
def add_git_remote
|
92
|
-
context.shell "git remote add deis #{git_remote_url}"
|
93
|
-
end
|
94
|
-
|
95
|
-
def git_push_url
|
96
|
-
"deis-repo:#{option(:app)}.git"
|
97
|
-
end
|
98
|
-
|
99
|
-
def git_remote_url
|
100
|
-
"ssh://git@#{option(:controller)}:2222/#{option(:app)}.git"
|
101
|
-
end
|
102
|
-
|
103
|
-
def controller_url
|
104
|
-
"http://#{option(:controller)}"
|
105
|
-
end
|
106
57
|
end
|
107
58
|
end
|
108
59
|
end
|
data/spec/provider/deis_spec.rb
CHANGED
@@ -6,9 +6,10 @@ describe DPL::Provider::Deis do
|
|
6
6
|
{
|
7
7
|
:app => 'example',
|
8
8
|
:key_name => 'key',
|
9
|
-
:controller => 'deis.deisapps.com',
|
9
|
+
:controller => 'https://deis.deisapps.com',
|
10
10
|
:username => 'travis',
|
11
|
-
:password => 'secret'
|
11
|
+
:password => 'secret',
|
12
|
+
:client_version => '1.0'
|
12
13
|
}
|
13
14
|
end
|
14
15
|
|
@@ -17,14 +18,10 @@ describe DPL::Provider::Deis do
|
|
17
18
|
end
|
18
19
|
|
19
20
|
describe "#install_deploy_dependencies" do
|
20
|
-
example
|
21
|
-
expect(provider.
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
example 'with version specified' do
|
26
|
-
options[:cli_version] = '1.0'
|
27
|
-
expect(provider.class).to receive(:pip).with('deis', 'deis', '1.0')
|
21
|
+
example do
|
22
|
+
expect(provider.context).to receive(:shell).with(
|
23
|
+
'curl -sSL http://deis.io/deis-cli/install.sh | sh -s 1.0'
|
24
|
+
).and_return(true)
|
28
25
|
provider.install_deploy_dependencies
|
29
26
|
end
|
30
27
|
end
|
@@ -38,7 +35,7 @@ describe DPL::Provider::Deis do
|
|
38
35
|
describe "#check_auth" do
|
39
36
|
example do
|
40
37
|
expect(provider.context).to receive(:shell).with(
|
41
|
-
'deis login
|
38
|
+
'./deis login https://deis.deisapps.com --username=travis --password=secret'
|
42
39
|
).and_return(true)
|
43
40
|
provider.check_auth
|
44
41
|
end
|
@@ -47,7 +44,7 @@ describe DPL::Provider::Deis do
|
|
47
44
|
describe "#check_app" do
|
48
45
|
example do
|
49
46
|
expect(provider.context).to receive(:shell).with(
|
50
|
-
'deis apps:info --app=example'
|
47
|
+
'./deis apps:info --app=example'
|
51
48
|
).and_return(true)
|
52
49
|
provider.check_app
|
53
50
|
end
|
@@ -59,31 +56,17 @@ describe DPL::Provider::Deis do
|
|
59
56
|
let(:identity_file) { File.join(Dir.pwd, 'key_file') }
|
60
57
|
example do
|
61
58
|
expect(provider.context).to receive(:shell).with(
|
62
|
-
'deis keys:add key_file'
|
59
|
+
'./deis keys:add key_file'
|
63
60
|
).and_return(true)
|
64
61
|
provider.setup_key('key_file')
|
65
62
|
end
|
66
63
|
end
|
67
64
|
|
68
65
|
describe "#setup_git_ssh" do
|
69
|
-
let(:ssh_config_handle) { double 'ssh_config_handle' }
|
70
|
-
let(:ssh_config) { File.join(Dir.home, '.ssh', 'config') }
|
71
|
-
let(:identity_file) { File.join(Dir.pwd, 'key_file') }
|
72
|
-
let(:git_ssh) { File.join(Dir.pwd, 'foo') }
|
73
|
-
after { FileUtils.rm provider.context.env.delete('GIT_SSH') }
|
74
|
-
|
75
66
|
example do
|
76
|
-
expect(File).to receive(:open).with(git_ssh, 'w').and_call_original
|
77
|
-
expect(File).to receive(:open).with(ssh_config, 'a')
|
78
|
-
.and_yield(ssh_config_handle)
|
79
|
-
|
80
|
-
expect(ssh_config_handle).to receive(:write).with(
|
81
|
-
"\nHost deis-repo\n Hostname deis.deisapps.com\n Port 2222\n" \
|
82
|
-
" User git\n IdentityFile #{identity_file}\n"
|
83
|
-
)
|
84
67
|
expect(provider.context).to receive(:shell).with(
|
85
|
-
'
|
86
|
-
)
|
68
|
+
'./deis git:remote --app=example'
|
69
|
+
).and_return(true)
|
87
70
|
provider.setup_git_ssh('foo', 'key_file')
|
88
71
|
end
|
89
72
|
end
|
@@ -91,7 +74,7 @@ describe DPL::Provider::Deis do
|
|
91
74
|
describe "#remove_key" do
|
92
75
|
example do
|
93
76
|
expect(provider.context).to receive(:shell).with(
|
94
|
-
'deis keys:remove key'
|
77
|
+
'./deis keys:remove key'
|
95
78
|
).and_return(true)
|
96
79
|
provider.remove_key
|
97
80
|
end
|
@@ -100,7 +83,7 @@ describe DPL::Provider::Deis do
|
|
100
83
|
describe "#push_app" do
|
101
84
|
example do
|
102
85
|
expect(provider.context).to receive(:shell).with(
|
103
|
-
'git push deis
|
86
|
+
'git push deis HEAD:refs/heads/master -f'
|
104
87
|
).and_return(true)
|
105
88
|
provider.push_app
|
106
89
|
end
|
@@ -109,7 +92,7 @@ describe DPL::Provider::Deis do
|
|
109
92
|
describe "#run" do
|
110
93
|
example do
|
111
94
|
expect(provider.context).to receive(:shell).with(
|
112
|
-
'deis
|
95
|
+
'deis run -- shell command'
|
113
96
|
).and_return(true)
|
114
97
|
provider.run('shell command')
|
115
98
|
end
|