dpl 1.8.38.travis.2151.5 → 1.8.38.travis.2156.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -3
- data/lib/dpl/provider/heroku.rb +0 -2
- metadata +2 -6
- data/lib/dpl/provider/heroku/git_deploy_key.rb +0 -33
- data/lib/dpl/provider/heroku/git_ssh.rb +0 -103
- data/spec/provider/heroku_git_deploy_key_spec.rb +0 -15
- data/spec/provider/heroku_git_ssh_spec.rb +0 -110
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9332b37a095fa6f216f3ca5f7557ef69ed81bff
|
4
|
+
data.tar.gz: d5b4ac4956afc9d74c24fc25706c8ed566b7d347
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 965365fe4aa5c096f231bf3df3d9089a4d69d6b5a5efc5654b057b7757be343b15ec5822355e2248091b4842eeb4283b66d0cdca42bdaa430dcc599da52f48a5
|
7
|
+
data.tar.gz: d60281cadfafb0953e3ea8ca27e720f87ef9aec46d7d5da722de6ea0e46e89f637640dbace49f9b8123c38c189d6398db64e612cde13aba0d47a1059380f3331
|
data/README.md
CHANGED
@@ -70,15 +70,14 @@ Running dpl in a terminal that saves history is insecure as your password/api ke
|
|
70
70
|
|
71
71
|
#### Options:
|
72
72
|
* **api-key**: Heroku API Key
|
73
|
-
* **strategy**: Deployment strategy for Dpl. Defaults to `api`.
|
73
|
+
* **strategy**: Deployment strategy for Dpl. Defaults to `api`. The other option is `git`.
|
74
74
|
* **app**: Heroku app name. Defaults to the name of your git repo.
|
75
75
|
* **username**: heroku username. Not necessary if api-key is used. Requires git strategy.
|
76
76
|
* **password**: heroku password. Not necessary if api-key is used. Requires git strategy.
|
77
77
|
|
78
|
-
#### API vs Git
|
78
|
+
#### API vs Git Deploy:
|
79
79
|
* API deploy will tar up the current directory (minus the git repo) and send it to Heroku.
|
80
80
|
* Git deploy will send the contents of the git repo only, so may not contain any local changes.
|
81
|
-
* Anvil deploys are no longer supported since Heroku shut down the Anvil service.
|
82
81
|
* The Git strategy allows using *user* and *password* instead of *api-key*.
|
83
82
|
* When using Git, Heroku might send you an email for every deploy, as it adds a temporary SSH key to your account.
|
84
83
|
|
data/lib/dpl/provider/heroku.rb
CHANGED
@@ -4,8 +4,6 @@ module DPL
|
|
4
4
|
autoload :API, 'dpl/provider/heroku/api'
|
5
5
|
autoload :Generic, 'dpl/provider/heroku/generic'
|
6
6
|
autoload :Git, 'dpl/provider/heroku/git'
|
7
|
-
autoload :GitSSH, 'dpl/provider/heroku/git_ssh'
|
8
|
-
autoload :GitDeployKey, 'dpl/provider/heroku/git_deploy_key'
|
9
7
|
|
10
8
|
extend self
|
11
9
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dpl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.38.travis.
|
4
|
+
version: 1.8.38.travis.2156.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: 2017-06-
|
11
|
+
date: 2017-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -147,8 +147,6 @@ files:
|
|
147
147
|
- lib/dpl/provider/heroku/api.rb
|
148
148
|
- lib/dpl/provider/heroku/generic.rb
|
149
149
|
- lib/dpl/provider/heroku/git.rb
|
150
|
-
- lib/dpl/provider/heroku/git_deploy_key.rb
|
151
|
-
- lib/dpl/provider/heroku/git_ssh.rb
|
152
150
|
- lib/dpl/provider/lambda.rb
|
153
151
|
- lib/dpl/provider/launchpad.rb
|
154
152
|
- lib/dpl/provider/modulus.rb
|
@@ -192,8 +190,6 @@ files:
|
|
192
190
|
- spec/provider/gae_spec.rb
|
193
191
|
- spec/provider/gcs_spec.rb
|
194
192
|
- spec/provider/hackage_spec.rb
|
195
|
-
- spec/provider/heroku_git_deploy_key_spec.rb
|
196
|
-
- spec/provider/heroku_git_ssh_spec.rb
|
197
193
|
- spec/provider/heroku_spec.rb
|
198
194
|
- spec/provider/lambda_spec.rb
|
199
195
|
- spec/provider/launchpad_spec.rb
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module DPL
|
2
|
-
class Provider
|
3
|
-
module Heroku
|
4
|
-
class GitDeployKey < GitSSH
|
5
|
-
deprecated(
|
6
|
-
"git-deploy-key strategy is deprecated, and will be shut down on June 26, 2017.",
|
7
|
-
"Please consider moving to the \`api\` or \`git\` strategy."
|
8
|
-
)
|
9
|
-
|
10
|
-
def needs_key?
|
11
|
-
false
|
12
|
-
end
|
13
|
-
|
14
|
-
def check_auth
|
15
|
-
super
|
16
|
-
setup_git_ssh
|
17
|
-
end
|
18
|
-
|
19
|
-
def setup_git_ssh
|
20
|
-
path = File.expand_path(".dpl/git-ssh")
|
21
|
-
|
22
|
-
File.open(path, 'w') do |file|
|
23
|
-
file.write "#!/bin/sh\n"
|
24
|
-
file.write "exec ssh -o StrictHostKeychecking=no -o CheckHostIP=no -o UserKnownHostsFile=/dev/null -- \"$@\"\n"
|
25
|
-
end
|
26
|
-
|
27
|
-
chmod(0740, path)
|
28
|
-
context.env['GIT_SSH'] = path
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,103 +0,0 @@
|
|
1
|
-
module DPL
|
2
|
-
class Provider
|
3
|
-
module Heroku
|
4
|
-
class GitSSH < Provider
|
5
|
-
deprecated(
|
6
|
-
"git-ssh strategy is deprecated, and will be shut down on June 26, 2017.",
|
7
|
-
"Please consider moving to the \`api\` or \`git\` strategy."
|
8
|
-
)
|
9
|
-
|
10
|
-
requires 'heroku-api'
|
11
|
-
requires 'rendezvous'
|
12
|
-
requires 'netrc'
|
13
|
-
|
14
|
-
def needs_key?
|
15
|
-
false
|
16
|
-
end
|
17
|
-
|
18
|
-
def api
|
19
|
-
@api ||= ::Heroku::API.new(api_options)
|
20
|
-
end
|
21
|
-
|
22
|
-
def api_options
|
23
|
-
api_options = { headers: { 'User-Agent' => user_agent(::Heroku::API::HEADERS.fetch('User-Agent')) } }
|
24
|
-
if options[:user] and options[:password]
|
25
|
-
api_options[:user] = options[:user]
|
26
|
-
api_options[:password] = options[:password]
|
27
|
-
else
|
28
|
-
api_options[:api_key] = option(:api_key)
|
29
|
-
end
|
30
|
-
api_options
|
31
|
-
end
|
32
|
-
|
33
|
-
def user
|
34
|
-
@user ||= api.get_user.body["email"]
|
35
|
-
end
|
36
|
-
|
37
|
-
def check_auth
|
38
|
-
log "authenticated as %s" % user
|
39
|
-
end
|
40
|
-
|
41
|
-
def info
|
42
|
-
@info ||= api.get_app(option(:app)).body
|
43
|
-
end
|
44
|
-
|
45
|
-
def check_app
|
46
|
-
log "checking for app '#{option(:app)}'"
|
47
|
-
log "found app '#{info['name']}'"
|
48
|
-
rescue ::Heroku::API::Errors::Forbidden => error
|
49
|
-
raise Error, "#{error.message} (does the app '#{option(:app)}' exist and does your account have access to it?)", error.backtrace
|
50
|
-
end
|
51
|
-
|
52
|
-
def run(command)
|
53
|
-
data = api.post_ps(option(:app), command, :attach => true).body
|
54
|
-
rendezvous_url = data['rendezvous_url']
|
55
|
-
Rendezvous.start(:url => rendezvous_url) unless rendezvous_url.nil?
|
56
|
-
end
|
57
|
-
|
58
|
-
def restart
|
59
|
-
api.post_ps_restart option(:app)
|
60
|
-
end
|
61
|
-
|
62
|
-
def deploy
|
63
|
-
super
|
64
|
-
rescue ::Heroku::API::Errors::NotFound => error
|
65
|
-
raise Error, "#{error.message} (wrong app #{options[:app].inspect}?)", error.backtrace
|
66
|
-
rescue ::Heroku::API::Errors::Unauthorized => error
|
67
|
-
raise Error, "#{error.message} (wrong API key?)", error.backtrace
|
68
|
-
end
|
69
|
-
|
70
|
-
def push_app
|
71
|
-
git_remote = options[:git] || git_url
|
72
|
-
write_netrc if git_remote.start_with?("https://")
|
73
|
-
log "$ git fetch origin $TRAVIS_BRANCH --unshallow"
|
74
|
-
context.shell "git fetch origin $TRAVIS_BRANCH --unshallow"
|
75
|
-
log "$ git push #{git_remote} HEAD:refs/heads/master -f"
|
76
|
-
context.shell "git push #{git_remote} HEAD:refs/heads/master -f"
|
77
|
-
end
|
78
|
-
|
79
|
-
def write_netrc
|
80
|
-
n = Netrc.read
|
81
|
-
n['git.heroku.com'] = [user, option(:api_key)]
|
82
|
-
n.save
|
83
|
-
end
|
84
|
-
|
85
|
-
def git_url
|
86
|
-
info['git_url']
|
87
|
-
end
|
88
|
-
|
89
|
-
def needs_key?
|
90
|
-
true
|
91
|
-
end
|
92
|
-
|
93
|
-
def setup_key(file)
|
94
|
-
api.post_key File.read(file)
|
95
|
-
end
|
96
|
-
|
97
|
-
def remove_key
|
98
|
-
api.delete_key(option(:key_name))
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'heroku-api'
|
3
|
-
require 'dpl/provider/heroku'
|
4
|
-
|
5
|
-
describe DPL::Provider::Heroku do
|
6
|
-
subject(:provider) do
|
7
|
-
described_class.new(DummyContext.new, :app => 'example', :key_name => 'key', :api_key => "foo", :strategy => "gitdeploykey")
|
8
|
-
end
|
9
|
-
|
10
|
-
describe "#ssh" do
|
11
|
-
it "doesn't require an ssh key" do
|
12
|
-
expect(provider.needs_key?).to eq(false)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,110 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'heroku-api'
|
3
|
-
require 'dpl/provider/heroku'
|
4
|
-
|
5
|
-
describe DPL::Provider::Heroku do
|
6
|
-
subject :provider do
|
7
|
-
described_class.new(DummyContext.new, :app => 'example', :key_name => 'key', :api_key => "foo", :strategy => "git-ssh")
|
8
|
-
end
|
9
|
-
|
10
|
-
let(:expected_headers) do
|
11
|
-
{ "User-Agent" => "dpl/#{DPL::VERSION} heroku-rb/#{Heroku::API::VERSION}" }
|
12
|
-
end
|
13
|
-
|
14
|
-
describe "#api" do
|
15
|
-
it 'accepts an api key' do
|
16
|
-
api = double(:api)
|
17
|
-
expect(::Heroku::API).to receive(:new).with(:api_key => "foo", :headers => expected_headers).and_return(api)
|
18
|
-
expect(provider.api).to eq(api)
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'accepts a user and a password' do
|
22
|
-
api = double(:api)
|
23
|
-
provider.options.update(:user => "foo", :password => "bar")
|
24
|
-
expect(::Heroku::API).to receive(:new).with(:user => "foo", :password => "bar", :headers => expected_headers).and_return(api)
|
25
|
-
expect(provider.api).to eq(api)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
context "with fake api" do
|
30
|
-
let :api do
|
31
|
-
double "api",
|
32
|
-
:get_user => double("get_user", :body => { "email" => "foo@bar.com" }),
|
33
|
-
:get_app => double("get_app", :body => { "name" => "example", "git_url" => "GIT URL" })
|
34
|
-
end
|
35
|
-
|
36
|
-
before do
|
37
|
-
expect(::Heroku::API).to receive(:new).and_return(api)
|
38
|
-
provider.api
|
39
|
-
end
|
40
|
-
|
41
|
-
its(:api) { should be == api }
|
42
|
-
|
43
|
-
describe "#check_auth" do
|
44
|
-
example do
|
45
|
-
expect(provider).to receive(:log).with("authenticated as foo@bar.com")
|
46
|
-
provider.check_auth
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
describe "#check_app" do
|
51
|
-
example do
|
52
|
-
expect(provider).to receive(:log).at_least(1).times.with(/example/)
|
53
|
-
provider.check_app
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
describe "#setup_key" do
|
58
|
-
example do
|
59
|
-
expect(File).to receive(:read).with("the file").and_return("foo")
|
60
|
-
expect(api).to receive(:post_key).with("foo")
|
61
|
-
provider.setup_key("the file")
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
describe "#remove_key" do
|
66
|
-
example do
|
67
|
-
expect(api).to receive(:delete_key).with("key")
|
68
|
-
provider.remove_key
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
describe "#push_app" do
|
73
|
-
example do
|
74
|
-
provider.options[:git] = "git://something"
|
75
|
-
expect(provider.context).to receive(:shell).with("git fetch origin $TRAVIS_BRANCH --unshallow")
|
76
|
-
expect(provider.context).to receive(:shell).with("git push git://something HEAD:refs/heads/master -f")
|
77
|
-
provider.push_app
|
78
|
-
expect(provider.context.env['GIT_HTTP_USER_AGENT']).to include("dpl/#{DPL::VERSION}")
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
describe "#run" do
|
83
|
-
example do
|
84
|
-
data = double("data", :body => { "rendezvous_url" => "rendezvous url" })
|
85
|
-
expect(api).to receive(:post_ps).with("example", "that command", :attach => true).and_return(data)
|
86
|
-
expect(Rendezvous).to receive(:start).with(:url => "rendezvous url")
|
87
|
-
provider.run("that command")
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
describe "#restart" do
|
92
|
-
example do
|
93
|
-
expect(api).to receive(:post_ps_restart).with("example")
|
94
|
-
provider.restart
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
describe "#deploy" do
|
99
|
-
example "not found error" do
|
100
|
-
expect(provider).to receive(:api) { raise ::Heroku::API::Errors::NotFound.new("the message", nil) }.at_least(:once)
|
101
|
-
expect { provider.deploy }.to raise_error(DPL::Error, 'the message (wrong app "example"?)')
|
102
|
-
end
|
103
|
-
|
104
|
-
example "unauthorized error" do
|
105
|
-
expect(provider).to receive(:api) { raise ::Heroku::API::Errors::Unauthorized.new("the message", nil) }.at_least(:once)
|
106
|
-
expect { provider.deploy }.to raise_error(DPL::Error, 'the message (wrong API key?)')
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|