dpl-scalingo 1.10.12.travis.3794.5 → 1.10.12.travis.4032.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dpl/provider/scalingo.rb +46 -28
- data/lib/dpl/version.rb +1 -1
- data/spec/provider/scalingo_spec.rb +8 -16
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a3376ab88b0f6e1c0c38bd240684f507076f63b40b97d9a93c3fe61b6dd0cb7
|
4
|
+
data.tar.gz: 76e05f8b2be048bb62d2a35def3ae494238632b89c3810b1984f9792b67c6a43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ca418a0e4254887c7f69e76a9c8f504ce45ebc7ebe54e385c6e2d7b4eb56ab31b436447db83662dbc85d281607d2f427c3835b00a49683f848ed0d5704338bc
|
7
|
+
data.tar.gz: d6e85e896c6fd9d0083e5095bb6b466cd4ff70aa787c52b8015847dcdc2c29c46e66eb3e22b3df652bc4118a3894b8aa489c5b5ecca7aa465c461a79755715f8
|
@@ -6,63 +6,81 @@ require 'date'
|
|
6
6
|
module DPL
|
7
7
|
class Provider
|
8
8
|
class Scalingo < Provider
|
9
|
-
|
10
9
|
def install_deploy_dependencies
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
download_url = 'https://cli-dl.scalingo.io/release/scalingo_latest_linux_amd64.tar.gz'
|
11
|
+
command = 'curl'
|
12
|
+
command = "#{command} --silent" if !@debug
|
13
|
+
command = "#{command} --remote-name --location #{download_url}"
|
14
|
+
tar_options = 'v' if @debug
|
15
|
+
tar_options = "#{tar_options}zxf"
|
16
|
+
command = "#{command} && tar -#{tar_options} scalingo_latest_linux_amd64.tar.gz" \
|
17
|
+
' && mv scalingo_*_linux_amd64/scalingo .' \
|
18
|
+
' && rm scalingo_latest_linux_amd64.tar.gz' \
|
19
|
+
' && rm -r scalingo_*_linux_amd64'
|
20
|
+
|
21
|
+
error "Couldn't install Scalingo CLI." if !context.shell command
|
14
22
|
end
|
15
23
|
|
16
24
|
def initialize(context, options)
|
17
25
|
super
|
18
26
|
@options = options
|
19
|
-
@remote = options[:remote] ||
|
20
|
-
@branch = options[:branch] ||
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
context.shell "DISABLE_INTERACTIVE=true ./scalingo login 2> /dev/null > /dev/null"
|
27
|
+
@remote = options[:remote] || 'scalingo-dpl'
|
28
|
+
@branch = options[:branch] || 'master'
|
29
|
+
@region = options[:region] || 'agora-fr1'
|
30
|
+
@timeout = options[:timeout] || '60'
|
31
|
+
@debug = !options[:debug].nil?
|
25
32
|
end
|
26
33
|
|
27
34
|
def check_auth
|
28
35
|
token = @options[:api_key] || @options[:api_token]
|
29
36
|
if token
|
30
|
-
|
37
|
+
scalingo("login --api-token #{token}")
|
31
38
|
elsif @options[:username] && @options[:password]
|
32
|
-
|
33
|
-
end
|
34
|
-
if !logged_in
|
35
|
-
error "Couldn't connect to Scalingo API."
|
39
|
+
scalingo('login', [], "echo -e \"#{@options[:username]}\n#{@options[:password]}\"")
|
36
40
|
end
|
37
41
|
end
|
38
42
|
|
39
|
-
def setup_key(file,
|
40
|
-
if !
|
41
|
-
error "Couldn't
|
42
|
-
end
|
43
|
-
unless context.shell "./scalingo keys-add dpl_tmp_key #{file}"
|
44
|
-
error "Couldn't add ssh key."
|
43
|
+
def setup_key(file, _type = nil)
|
44
|
+
if !scalingo("keys-add dpl_tmp_key #{file}")
|
45
|
+
error "Couldn't add SSH key."
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
48
49
|
def remove_key
|
49
|
-
if !
|
50
|
-
error "Couldn't
|
51
|
-
end
|
52
|
-
unless context.shell "./scalingo keys-remove dpl_tmp_key"
|
53
|
-
error "Couldn't remove ssh key."
|
50
|
+
if !scalingo('keys-remove dpl_tmp_key')
|
51
|
+
error "Couldn't remove SSH key."
|
54
52
|
end
|
55
53
|
end
|
56
54
|
|
57
55
|
def push_app
|
56
|
+
install_deploy_dependencies
|
57
|
+
|
58
58
|
if @options[:app]
|
59
|
-
|
59
|
+
if !scalingo("--app #{@options[:app]} git-setup --remote #{@remote}")
|
60
|
+
error 'Failed to add the Git remote.'
|
61
|
+
end
|
60
62
|
end
|
61
|
-
|
63
|
+
|
64
|
+
if !context.shell "git push #{@remote} #{@branch} --force"
|
62
65
|
error "Couldn't push your app."
|
63
66
|
end
|
64
67
|
end
|
65
68
|
|
69
|
+
def scalingo(command, env = [], input = '')
|
70
|
+
env << "SCALINGO_REGION=#{@region}" if !@region.empty?
|
71
|
+
|
72
|
+
if @debug
|
73
|
+
env << 'DEBUG=1'
|
74
|
+
else
|
75
|
+
command += ' > /dev/null'
|
76
|
+
end
|
77
|
+
command = "#{env.join(' ')} timeout #{@timeout} ./scalingo #{command}"
|
78
|
+
command = "#{input} | #{command}" if input != ''
|
79
|
+
|
80
|
+
puts "Execute #{command}" if @debug
|
81
|
+
|
82
|
+
context.shell command
|
83
|
+
end
|
66
84
|
end
|
67
85
|
end
|
68
86
|
end
|
data/lib/dpl/version.rb
CHANGED
@@ -2,7 +2,6 @@ require 'spec_helper'
|
|
2
2
|
require 'dpl/provider/scalingo'
|
3
3
|
|
4
4
|
describe DPL::Provider::Scalingo do
|
5
|
-
|
6
5
|
subject :provider do
|
7
6
|
described_class.new(DummyContext.new, :username => 'travis', :password => 'secret', :remote => 'scalingo', :branch => 'master')
|
8
7
|
end
|
@@ -10,7 +9,7 @@ describe DPL::Provider::Scalingo do
|
|
10
9
|
describe "#install_deploy_dependencies" do
|
11
10
|
example do
|
12
11
|
expect(provider.context).to receive(:shell).with(
|
13
|
-
'curl -
|
12
|
+
'curl --silent --remote-name --location https://cli-dl.scalingo.io/release/scalingo_latest_linux_amd64.tar.gz && tar -zxf scalingo_latest_linux_amd64.tar.gz && mv scalingo_*_linux_amd64/scalingo . && rm scalingo_latest_linux_amd64.tar.gz && rm -r scalingo_*_linux_amd64'
|
14
13
|
).and_return(true)
|
15
14
|
provider.install_deploy_dependencies
|
16
15
|
end
|
@@ -19,10 +18,7 @@ describe DPL::Provider::Scalingo do
|
|
19
18
|
describe "#check_auth" do
|
20
19
|
example do
|
21
20
|
expect(provider.context).to receive(:shell).with(
|
22
|
-
"echo -e \"travis\nsecret\" | timeout
|
23
|
-
).and_return(true)
|
24
|
-
expect(provider.context).to receive(:shell).with(
|
25
|
-
'DISABLE_INTERACTIVE=true ./scalingo login 2> /dev/null > /dev/null'
|
21
|
+
"echo -e \"travis\nsecret\" | SCALINGO_REGION=agora-fr1 timeout 60 ./scalingo login > /dev/null"
|
26
22
|
).and_return(true)
|
27
23
|
provider.check_auth
|
28
24
|
end
|
@@ -31,10 +27,7 @@ describe DPL::Provider::Scalingo do
|
|
31
27
|
describe "#setup_key" do
|
32
28
|
example do
|
33
29
|
expect(provider.context).to receive(:shell).with(
|
34
|
-
'./scalingo keys-add dpl_tmp_key key_file'
|
35
|
-
).and_return(true)
|
36
|
-
expect(provider.context).to receive(:shell).with(
|
37
|
-
'DISABLE_INTERACTIVE=true ./scalingo login 2> /dev/null > /dev/null'
|
30
|
+
'SCALINGO_REGION=agora-fr1 timeout 60 ./scalingo keys-add dpl_tmp_key key_file > /dev/null'
|
38
31
|
).and_return(true)
|
39
32
|
provider.setup_key('key_file')
|
40
33
|
end
|
@@ -43,10 +36,7 @@ describe DPL::Provider::Scalingo do
|
|
43
36
|
describe "#remove_key" do
|
44
37
|
example do
|
45
38
|
expect(provider.context).to receive(:shell).with(
|
46
|
-
'./scalingo keys-remove dpl_tmp_key'
|
47
|
-
).and_return(true)
|
48
|
-
expect(provider.context).to receive(:shell).with(
|
49
|
-
'DISABLE_INTERACTIVE=true ./scalingo login 2> /dev/null > /dev/null'
|
39
|
+
'SCALINGO_REGION=agora-fr1 timeout 60 ./scalingo keys-remove dpl_tmp_key > /dev/null'
|
50
40
|
).and_return(true)
|
51
41
|
provider.remove_key
|
52
42
|
end
|
@@ -55,10 +45,12 @@ describe DPL::Provider::Scalingo do
|
|
55
45
|
describe "#push_app" do
|
56
46
|
example do
|
57
47
|
expect(provider.context).to receive(:shell).with(
|
58
|
-
|
48
|
+
'curl --silent --remote-name --location https://cli-dl.scalingo.io/release/scalingo_latest_linux_amd64.tar.gz && tar -zxf scalingo_latest_linux_amd64.tar.gz && mv scalingo_*_linux_amd64/scalingo . && rm scalingo_latest_linux_amd64.tar.gz && rm -r scalingo_*_linux_amd64'
|
49
|
+
).and_return(true)
|
50
|
+
expect(provider.context).to receive(:shell).with(
|
51
|
+
'git push scalingo master --force'
|
59
52
|
).and_return(true)
|
60
53
|
provider.push_app
|
61
54
|
end
|
62
55
|
end
|
63
|
-
|
64
56
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dpl-scalingo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.10.12.travis.
|
4
|
+
version: 1.10.12.travis.4032.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Haase
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dpl
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.10.12.travis.
|
19
|
+
version: 1.10.12.travis.4032.5
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.10.12.travis.
|
26
|
+
version: 1.10.12.travis.4032.5
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|