dpl 2.0.3.beta.4 → 2.0.3.beta.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +15 -3
- data/Gemfile.lock +444 -211
- data/Rakefile +36 -34
- data/bin/dpl +3 -1
- data/dpl.gemspec +25 -0
- data/lib/dpl/cli.rb +19 -14
- data/lib/dpl/ctx/bash.rb +18 -12
- data/lib/dpl/ctx/test.rb +21 -15
- data/lib/dpl/ctx.rb +2 -0
- data/lib/dpl/helper/assets.rb +4 -2
- data/lib/dpl/helper/cmd.rb +20 -18
- data/lib/dpl/helper/config_file.rb +5 -3
- data/lib/dpl/helper/cookbook_site_streaming_uploader.rb +249 -0
- data/lib/dpl/helper/env.rb +26 -22
- data/lib/dpl/helper/github.rb +2 -0
- data/lib/dpl/helper/interpolate.rb +8 -4
- data/lib/dpl/helper/memoize.rb +4 -1
- data/lib/dpl/helper/squiggle.rb +3 -1
- data/lib/dpl/helper/transliterate.rb +3 -1
- data/lib/dpl/helper/wrap.rb +3 -1
- data/lib/dpl/helper/zip.rb +3 -1
- data/lib/dpl/provider/dsl.rb +18 -4
- data/lib/dpl/provider/examples.rb +6 -2
- data/lib/dpl/provider/status.rb +26 -24
- data/lib/dpl/providers/anynines.rb +22 -20
- data/lib/dpl/providers/azure_web_apps.rb +21 -19
- data/lib/dpl/providers/bintray.rb +44 -37
- data/lib/dpl/providers/bluemixcloudfoundry.rb +38 -36
- data/lib/dpl/providers/boxfuse.rb +12 -10
- data/lib/dpl/providers/cargo.rb +7 -5
- data/lib/dpl/providers/chef_supermarket.rb +82 -80
- data/lib/dpl/providers/cloud66.rb +17 -15
- data/lib/dpl/providers/cloudfiles.rb +8 -6
- data/lib/dpl/providers/cloudformation.rb +191 -187
- data/lib/dpl/providers/cloudfoundry.rb +32 -30
- data/lib/dpl/providers/codedeploy.rb +35 -33
- data/lib/dpl/providers/convox.rb +32 -25
- data/lib/dpl/providers/datica.rb +30 -28
- data/lib/dpl/providers/ecr.rb +66 -64
- data/lib/dpl/providers/elasticbeanstalk.rb +14 -12
- data/lib/dpl/providers/engineyard.rb +60 -58
- data/lib/dpl/providers/firebase.rb +6 -4
- data/lib/dpl/providers/flynn.rb +8 -6
- data/lib/dpl/providers/gae.rb +28 -25
- data/lib/dpl/providers/gcs.rb +59 -57
- data/lib/dpl/providers/git_push.rb +199 -195
- data/lib/dpl/providers/gleis.rb +19 -17
- data/lib/dpl/providers/hackage.rb +15 -13
- data/lib/dpl/providers/hephy.rb +18 -16
- data/lib/dpl/providers/heroku/api.rb +72 -70
- data/lib/dpl/providers/heroku/git.rb +15 -13
- data/lib/dpl/providers/heroku.rb +40 -38
- data/lib/dpl/providers/lambda.rb +134 -134
- data/lib/dpl/providers/launchpad.rb +45 -43
- data/lib/dpl/providers/netlify.rb +7 -5
- data/lib/dpl/providers/npm.rb +61 -58
- data/lib/dpl/providers/nuget.rb +8 -6
- data/lib/dpl/providers/openshift.rb +8 -6
- data/lib/dpl/providers/opsworks.rb +23 -21
- data/lib/dpl/providers/pages/api.rb +14 -14
- data/lib/dpl/providers/pages/git.rb +53 -47
- data/lib/dpl/providers/pages.rb +3 -1
- data/lib/dpl/providers/puppetforge.rb +6 -4
- data/lib/dpl/providers/pypi.rb +55 -54
- data/lib/dpl/providers/releases.rb +30 -23
- data/lib/dpl/providers/rubygems.rb +35 -31
- data/lib/dpl/providers/s3.rb +148 -142
- data/lib/dpl/providers/scalingo.rb +18 -16
- data/lib/dpl/providers/script.rb +4 -2
- data/lib/dpl/providers/snap.rb +12 -9
- data/lib/dpl/providers/surge.rb +7 -5
- data/lib/dpl/providers/testfairy.rb +47 -43
- data/lib/dpl/providers/transifex.rb +20 -18
- data/lib/dpl/providers.rb +3 -1
- data/lib/dpl/string_ext.rb +3 -1
- data/lib/dpl/support/aws_sdk_patch.rb +4 -1
- data/lib/dpl/support/gems.rb +7 -3
- data/lib/dpl/support/gstore_patch.rb +3 -1
- data/lib/dpl/support/version.rb +13 -12
- data/lib/dpl/version.rb +3 -1
- data/lib/dpl.rb +2 -0
- data/status.json +237 -0
- metadata +32 -15
- /data/lib/dpl/providers/{packagecloud.rb → packagecloud.rb_} +0 -0
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Dpl
|
2
4
|
module Providers
|
3
5
|
class Engineyard < Provider
|
@@ -5,13 +7,13 @@ module Dpl
|
|
5
7
|
|
6
8
|
status :alpha
|
7
9
|
|
8
|
-
description sq(<<-
|
10
|
+
description sq(<<-STR)
|
9
11
|
tbd
|
10
|
-
|
12
|
+
STR
|
11
13
|
|
12
|
-
gem 'ey-core', '~> 3.
|
14
|
+
gem 'ey-core', '~> 3.6'
|
13
15
|
|
14
|
-
required :api_key, [
|
16
|
+
required :api_key, %i[email password]
|
15
17
|
|
16
18
|
env :engineyard, :ey
|
17
19
|
|
@@ -23,19 +25,19 @@ module Dpl
|
|
23
25
|
opt '--migrate CMD', 'Engine Yard migration commands'
|
24
26
|
opt '--account NAME', 'Engine Yard account name'
|
25
27
|
|
26
|
-
msgs deploy:
|
27
|
-
login:
|
28
|
-
write_rc:
|
29
|
-
authenticated:
|
30
|
-
invalid_migrate:
|
31
|
-
envs:
|
32
|
-
no_env:
|
33
|
-
too_many_envs:
|
34
|
-
env_entry:
|
35
|
-
|
36
|
-
cmds login:
|
28
|
+
msgs deploy: 'Deploying ...',
|
29
|
+
login: 'Authenticating via email and password ...',
|
30
|
+
write_rc: 'Authenticating via api token ...',
|
31
|
+
authenticated: 'Authenticated as %{name}',
|
32
|
+
invalid_migrate: 'Invalid migration command, try --migrate="rake db:migrate"',
|
33
|
+
envs: 'Checking environment ...',
|
34
|
+
no_env: 'No matching environment found',
|
35
|
+
too_many_envs: 'Multiple environments match, please be more specific: %s',
|
36
|
+
env_entry: 'environment=%s account=%s'
|
37
|
+
|
38
|
+
cmds login: "ey-core login << str\n%{email}\n%{password}\nstr",
|
37
39
|
whoami: 'ey-core whoami',
|
38
|
-
envs:
|
40
|
+
envs: 'ey-core environments',
|
39
41
|
deploy: 'ey-core deploy %{deploy_opts}'
|
40
42
|
|
41
43
|
def login
|
@@ -54,58 +56,58 @@ module Dpl
|
|
54
56
|
|
55
57
|
private
|
56
58
|
|
57
|
-
|
58
|
-
|
59
|
-
|
59
|
+
def authenticate
|
60
|
+
shell :login, echo: false, capture: true
|
61
|
+
end
|
60
62
|
|
61
|
-
|
62
|
-
|
63
|
-
|
63
|
+
def whoami
|
64
|
+
shell(:whoami, echo: false, capture: true) =~ /email\s*:\s*"(.+)"/ && ::Regexp.last_match(1)
|
65
|
+
end
|
64
66
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
67
|
+
def write_rc
|
68
|
+
info :write_rc
|
69
|
+
write_file '~/.ey-core', "https://api.engineyard.com/: #{api_key}"
|
70
|
+
end
|
69
71
|
|
70
|
-
|
71
|
-
|
72
|
-
|
72
|
+
def invalid_migrate?
|
73
|
+
migrate.is_a?(TrueClass) || migrate == 'true'
|
74
|
+
end
|
73
75
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
76
|
+
def deploy_opts
|
77
|
+
opts = [%(--ref="#{git_sha}" --environment="#{env}")]
|
78
|
+
opts << opts_for(%i[app account])
|
79
|
+
opts << migrate_opt
|
80
|
+
opts.join(' ')
|
81
|
+
end
|
80
82
|
|
81
|
-
|
82
|
-
|
83
|
-
|
83
|
+
def migrate_opt
|
84
|
+
migrate? ? opts_for(%i[migrate]) : '--no-migrate'
|
85
|
+
end
|
84
86
|
|
85
|
-
|
86
|
-
|
87
|
-
|
87
|
+
def env
|
88
|
+
@env ||= super || detect_env(envs)
|
89
|
+
end
|
88
90
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
end
|
91
|
+
def detect_env(envs)
|
92
|
+
case envs.size
|
93
|
+
when 1 then envs.first[:name]
|
94
|
+
when 0 then error :no_env
|
95
|
+
else too_many_envs(envs)
|
95
96
|
end
|
97
|
+
end
|
96
98
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
99
|
+
def envs
|
100
|
+
lines = shell(:envs, echo: false, capture: true).split("\n")[2..] || []
|
101
|
+
envs = lines.map { |line| line.split('|')[1..].map(&:strip) }
|
102
|
+
envs = envs.map { |pair| %i[name account].zip(pair).to_h }
|
103
|
+
envs.select { |env| env[:name] == opts[:env] } if env?
|
104
|
+
envs
|
105
|
+
end
|
104
106
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
107
|
+
def too_many_envs(envs)
|
108
|
+
envs = envs.map { |env| msg(:env_entry) % env.values_at(:name, :account) }
|
109
|
+
error msg(:too_many_envs) % envs.join(', ')
|
110
|
+
end
|
109
111
|
end
|
110
112
|
end
|
111
113
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Dpl
|
2
4
|
module Providers
|
3
5
|
class Firebase < Provider
|
@@ -5,9 +7,9 @@ module Dpl
|
|
5
7
|
|
6
8
|
status :stable
|
7
9
|
|
8
|
-
description sq(<<-
|
10
|
+
description sq(<<-STR)
|
9
11
|
tbd
|
10
|
-
|
12
|
+
STR
|
11
13
|
|
12
14
|
node_js '>= 8.0.0'
|
13
15
|
|
@@ -28,7 +30,7 @@ module Dpl
|
|
28
30
|
msgs missing_config: 'Missing firebase.json'
|
29
31
|
|
30
32
|
def validate
|
31
|
-
error :missing_config unless File.
|
33
|
+
error :missing_config unless File.exist?('firebase.json')
|
32
34
|
end
|
33
35
|
|
34
36
|
def deploy
|
@@ -36,7 +38,7 @@ module Dpl
|
|
36
38
|
end
|
37
39
|
|
38
40
|
def deploy_opts
|
39
|
-
opts_for(%i
|
41
|
+
opts_for(%i[project message token only force])
|
40
42
|
end
|
41
43
|
end
|
42
44
|
end
|
data/lib/dpl/providers/flynn.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Dpl
|
2
4
|
module Providers
|
3
5
|
class Flynn < Provider
|
@@ -7,16 +9,16 @@ module Dpl
|
|
7
9
|
|
8
10
|
full_name 'Flynn'
|
9
11
|
|
10
|
-
description sq(<<-
|
12
|
+
description sq(<<-STR)
|
11
13
|
Flynn provider for Dpl
|
12
|
-
|
14
|
+
STR
|
13
15
|
|
14
16
|
opt '--git URL', 'Flynn Git remote URL', required: true
|
15
17
|
|
16
18
|
needs :git, :git_http_user_agent
|
17
19
|
|
18
20
|
cmds fetch: 'git fetch origin $TRAVIS_BRANCH --unshallow',
|
19
|
-
push:
|
21
|
+
push: 'git push %{remote} HEAD:refs/heads/master -f'
|
20
22
|
|
21
23
|
def deploy
|
22
24
|
shell :fetch, assert: false
|
@@ -25,9 +27,9 @@ module Dpl
|
|
25
27
|
|
26
28
|
private
|
27
29
|
|
28
|
-
|
29
|
-
|
30
|
-
|
30
|
+
def remote
|
31
|
+
git
|
32
|
+
end
|
31
33
|
end
|
32
34
|
end
|
33
35
|
end
|
data/lib/dpl/providers/gae.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Dpl
|
2
4
|
module Providers
|
3
5
|
class Gae < Provider
|
@@ -7,9 +9,9 @@ module Dpl
|
|
7
9
|
|
8
10
|
full_name 'Google App Engine'
|
9
11
|
|
10
|
-
description sq(<<-
|
12
|
+
description sq(<<-STR)
|
11
13
|
tbd
|
12
|
-
|
14
|
+
STR
|
13
15
|
|
14
16
|
python '>= 2.7.9'
|
15
17
|
|
@@ -26,20 +28,21 @@ module Dpl
|
|
26
28
|
|
27
29
|
URL = 'https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz'
|
28
30
|
|
29
|
-
cmds install:
|
30
|
-
login:
|
31
|
-
deploy:
|
32
|
-
cat_logs:
|
31
|
+
cmds install: 'curl -L %{URL} | tar xz -C ~ && ~/google-cloud-sdk/install.sh --path-update false --usage-reporting false --command-completion false',
|
32
|
+
login: 'gcloud -q auth activate-service-account --key-file %{keyfile}',
|
33
|
+
deploy: 'gcloud -q app deploy %{config} %{deploy_opts}',
|
34
|
+
cat_logs: 'find $HOME/.config/gcloud/logs -type f -print -exec cat {} \;'
|
33
35
|
|
34
|
-
errs install:
|
35
|
-
login:
|
36
|
+
errs install: 'Failed to download Google Cloud SDK.',
|
37
|
+
login: 'Failed to authenticate.'
|
36
38
|
|
37
|
-
msgs failed:
|
39
|
+
msgs failed: 'Deployment failed.'
|
38
40
|
|
39
41
|
path '~/google-cloud-sdk/bin'
|
40
42
|
|
41
43
|
def install
|
42
44
|
return unless install_sdk?
|
45
|
+
|
43
46
|
shell :install
|
44
47
|
end
|
45
48
|
|
@@ -54,22 +57,22 @@ module Dpl
|
|
54
57
|
|
55
58
|
private
|
56
59
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
60
|
+
def deploy_opts
|
61
|
+
opts = [*opts_for(%i[project verbosity version])]
|
62
|
+
opts << '--no-promote' unless promote?
|
63
|
+
opts << '--no-stop-previous-version' unless stop_previous_version?
|
64
|
+
opts.join(' ')
|
65
|
+
end
|
66
|
+
|
67
|
+
def failed
|
68
|
+
warn :failed
|
69
|
+
shell :cat_logs
|
70
|
+
error ''
|
71
|
+
end
|
72
|
+
|
73
|
+
def project
|
74
|
+
super || File.dirname(build_dir)
|
75
|
+
end
|
73
76
|
end
|
74
77
|
end
|
75
78
|
end
|
data/lib/dpl/providers/gcs.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'kconv'
|
2
4
|
|
3
5
|
module Dpl
|
@@ -9,17 +11,17 @@ module Dpl
|
|
9
11
|
|
10
12
|
full_name 'Google Cloud Store'
|
11
13
|
|
12
|
-
description sq(<<-
|
14
|
+
description sq(<<-STR)
|
13
15
|
tbd
|
14
|
-
|
16
|
+
STR
|
15
17
|
|
16
|
-
gem 'mime-types', '~> 3.
|
18
|
+
gem 'mime-types', '~> 3.4.1'
|
17
19
|
|
18
20
|
python '>= 2.7.9'
|
19
21
|
|
20
22
|
env :gcs
|
21
23
|
|
22
|
-
required :key_file, [
|
24
|
+
required :key_file, %i[access_key_id secret_access_key]
|
23
25
|
|
24
26
|
opt '--key_file FILE', 'Path to a GCS service account key JSON file'
|
25
27
|
opt '--access_key_id ID', 'GCS Interoperable Access Key ID', secret: true
|
@@ -28,28 +30,28 @@ module Dpl
|
|
28
30
|
opt '--local_dir DIR', 'Local directory to upload from', default: '.'
|
29
31
|
opt '--upload_dir DIR', 'GCS directory to upload to'
|
30
32
|
opt '--dot_match', 'Upload hidden files starting with a dot'
|
31
|
-
opt '--acl ACL', 'Access control to set for uploaded objects', default: 'private', enum: %w
|
33
|
+
opt '--acl ACL', 'Access control to set for uploaded objects', default: 'private', enum: %w[private public-read public-read-write authenticated-read bucket-owner-read bucket-owner-full-control], see: 'https://cloud.google.com/storage/docs/reference-headers#xgoogacl'
|
32
34
|
opt '--detect_encoding', 'HTTP header Content-Encoding to set for files compressed with gzip and compress utilities.'
|
33
35
|
opt '--cache_control HEADER', 'HTTP header Cache-Control to suggest that the browser cache the file.', see: 'https://cloud.google.com/storage/docs/xml-api/reference-headers#cachecontrol'
|
34
36
|
opt '--glob GLOB', default: '**/*'
|
35
37
|
|
36
|
-
cmds install:
|
38
|
+
cmds install: 'curl -L %{URL} | tar xz -C ~ && ~/google-cloud-sdk/install.sh --quiet --path-update false --usage-reporting false --command-completion false',
|
37
39
|
login_key: 'gcloud auth activate-service-account --key-file=%{key_file}',
|
38
|
-
rsync:
|
39
|
-
copy:
|
40
|
+
rsync: 'gsutil %{gs_opts} rsync %{rsync_opts} %{glob} %{target}',
|
41
|
+
copy: 'gsutil %{gs_opts} cp %{copy_opts} -r %{source} %{target}'
|
40
42
|
|
41
|
-
msgs login_key:
|
43
|
+
msgs login_key: 'Authenticating with service account key file %{key_file}',
|
42
44
|
login_creds: 'Authenticating with access key: %{access_key_id}'
|
43
45
|
|
44
|
-
errs copy:
|
46
|
+
errs copy: 'Failed uploading files.'
|
45
47
|
|
46
48
|
URL = 'https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz'
|
47
49
|
|
48
|
-
BOTO = sq(<<-
|
50
|
+
BOTO = sq(<<-STR)
|
49
51
|
[Credentials]
|
50
52
|
gs_access_key_id = %{access_key_id}
|
51
53
|
gs_secret_access_key = %{secret_access_key}
|
52
|
-
|
54
|
+
STR
|
53
55
|
|
54
56
|
path '~/google-cloud-sdk'
|
55
57
|
move '/etc/boto.cfg'
|
@@ -70,61 +72,61 @@ module Dpl
|
|
70
72
|
|
71
73
|
private
|
72
74
|
|
73
|
-
|
74
|
-
|
75
|
-
|
75
|
+
def login_key
|
76
|
+
shell :login_key
|
77
|
+
end
|
76
78
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
79
|
+
def login_creds
|
80
|
+
info :login_creds
|
81
|
+
write_boto
|
82
|
+
end
|
81
83
|
|
82
|
-
|
83
|
-
|
84
|
-
|
84
|
+
def write_boto
|
85
|
+
write_file '~/.boto', interpolate(BOTO, opts, secure: true), 0600
|
86
|
+
end
|
85
87
|
|
86
|
-
|
87
|
-
|
88
|
-
|
88
|
+
def files
|
89
|
+
Dir.glob(*glob_args).select { |path| File.file?(path) }
|
90
|
+
end
|
89
91
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
92
|
+
def copy(source)
|
93
|
+
to = [target.sub(%r{/$}, ''), source].join('/')
|
94
|
+
shell :copy, gs_opts: gs_opts(source), source:, target: to
|
95
|
+
end
|
94
96
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
97
|
+
def dirname(path)
|
98
|
+
dir = File.dirname(path)
|
99
|
+
dir unless dir.empty? || dir == '.'
|
100
|
+
end
|
99
101
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
102
|
+
def gs_opts(path)
|
103
|
+
opts = []
|
104
|
+
opts << %(-h "Cache-Control:#{cache_control}") if cache_control?
|
105
|
+
opts << %(-h "Content-Encoding:#{encoding(path)}") if detect_encoding?
|
106
|
+
opts << %(-h "Content-type:#{mime_type(path)}") if mime_type(path)
|
107
|
+
"#{opts.join(' ')} " if opts.any?
|
108
|
+
end
|
107
109
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
110
|
+
def copy_opts
|
111
|
+
opts = []
|
112
|
+
opts << %(-a "#{acl}") if acl?
|
113
|
+
"#{opts.join(' ')} " if opts.any?
|
114
|
+
end
|
113
115
|
|
114
|
-
|
115
|
-
|
116
|
-
|
116
|
+
def target
|
117
|
+
"gs://#{bucket}/#{upload_dir}"
|
118
|
+
end
|
117
119
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
120
|
+
def mime_type(path)
|
121
|
+
type = MIME::Types.type_for(path).first
|
122
|
+
type&.to_s
|
123
|
+
end
|
122
124
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
125
|
+
def glob_args
|
126
|
+
args = [glob]
|
127
|
+
args << File::FNM_DOTMATCH if dot_match?
|
128
|
+
args
|
129
|
+
end
|
128
130
|
end
|
129
131
|
end
|
130
132
|
end
|