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 GitPush < Provider
|
@@ -7,25 +9,25 @@ module Dpl
|
|
7
9
|
|
8
10
|
full_name 'Git (push)'
|
9
11
|
|
10
|
-
description sq(<<-
|
12
|
+
description sq(<<-STR)
|
11
13
|
Experimental, generic provider for updating a Git remote branch with
|
12
14
|
changes produced by the build, and optionally opening a pull request.
|
13
|
-
|
15
|
+
STR
|
14
16
|
|
15
|
-
gem 'octokit', '~>
|
16
|
-
gem 'public_suffix', '~>
|
17
|
+
gem 'octokit', '~> 7'
|
18
|
+
gem 'public_suffix', '~> 5'
|
17
19
|
|
18
20
|
env :github, :git
|
19
21
|
|
20
|
-
required :token, [
|
22
|
+
required :token, %i[deploy_key name email]
|
21
23
|
|
22
24
|
opt '--repo SLUG', 'Repo slug', default: :repo_slug
|
23
25
|
opt '--token TOKEN', 'GitHub token with repo permission', secret: true, alias: :github_token
|
24
26
|
opt '--deploy_key PATH', 'Path to a file containing a private deploy key with write access to the repository', see: 'https://developer.github.com/v3/guides/managing-deploy-keys/#deploy-keys'
|
25
27
|
opt '--branch BRANCH', 'Target branch to push to', required: true
|
26
28
|
opt '--base_branch BRANCH', 'Base branch to branch off initially, and (optionally) create a pull request for', default: 'master'
|
27
|
-
opt '--name NAME', 'Committer name', note: 'defaults to the GitHub name or login associated with the GitHub token'
|
28
|
-
opt '--email EMAIL', 'Committer email', note: 'defaults to the GitHub email associated with the GitHub token'
|
29
|
+
opt '--name NAME', 'Committer name', note: 'defaults to the GitHub name or login associated with the GitHub token' # , default: :user_name
|
30
|
+
opt '--email EMAIL', 'Committer email', note: 'defaults to the GitHub email associated with the GitHub token' # , default: :user_email
|
29
31
|
opt '--commit_message MSG', default: 'Update %{base_branch}', interpolate: true
|
30
32
|
opt '--allow_empty_commit', 'Allow an empty commit to be created'
|
31
33
|
opt '--force', 'Whether to push --force', default: false
|
@@ -37,38 +39,38 @@ module Dpl
|
|
37
39
|
|
38
40
|
needs :git
|
39
41
|
|
40
|
-
msgs login:
|
41
|
-
invalid_token:
|
42
|
+
msgs login: 'Authenticated as %s',
|
43
|
+
invalid_token: 'The provided GitHub token is invalid (error: %s)',
|
42
44
|
insufficient_scopes: 'Dpl does not have permission to access %{url} using the provided GitHub token. Please make sure the token have the repo or public_repo scope.',
|
43
|
-
same_branch:
|
44
|
-
setup_deploy_key:
|
45
|
-
check_deploy_key:
|
46
|
-
setup:
|
47
|
-
git_clone:
|
48
|
-
git_branch:
|
49
|
-
copy_files:
|
50
|
-
git_config:
|
51
|
-
git_push:
|
52
|
-
pr_exists:
|
53
|
-
pr_created:
|
54
|
-
stop:
|
55
|
-
|
56
|
-
cmds git_clone:
|
57
|
-
git_branch:
|
58
|
-
check_deploy_key:
|
59
|
-
copy_files:
|
60
|
-
git_config_email:
|
61
|
-
git_config_name:
|
62
|
-
git_add:
|
63
|
-
git_commit_hook:
|
64
|
-
git_commit:
|
65
|
-
git_show:
|
66
|
-
git_push:
|
67
|
-
|
68
|
-
errs copy_files:
|
69
|
-
check_deploy_key:
|
70
|
-
git_init:
|
71
|
-
git_push:
|
45
|
+
same_branch: 'Prevented from pushing to the same branch as the current build branch %{git_branch}. This is meant to prevent infinite build loops. If you do need to push back to the same branch enable `allow_same_branch` and take precautions to prevent infinite loops as needed, for example using conditional builds.',
|
46
|
+
setup_deploy_key: 'Moving deploy key %{deploy_key} to %{path}',
|
47
|
+
check_deploy_key: 'Checking deploy key',
|
48
|
+
setup: 'Source dir: %{src_dir}, branch: %{branch}, base branch: %{base_branch}',
|
49
|
+
git_clone: 'Cloning the branch %{branch} to %{work_dir}',
|
50
|
+
git_branch: 'Switching to branch %{branch}',
|
51
|
+
copy_files: 'Copying %{src_dir} contents to %{work_dir}',
|
52
|
+
git_config: 'Configuring git committer to be: %{name} <%{email}>',
|
53
|
+
git_push: 'Pushing to %{url} HEAD:%{branch}',
|
54
|
+
pr_exists: 'Pull request exists.',
|
55
|
+
pr_created: 'Pull request #%{number} created.',
|
56
|
+
stop: 'There are no changes to commit, stopping.'
|
57
|
+
|
58
|
+
cmds git_clone: 'git clone --quiet --branch="%{clone_branch}" "%{remote_url}" . > /dev/null 2>&1',
|
59
|
+
git_branch: 'git checkout -b "%{branch}"',
|
60
|
+
check_deploy_key: 'ssh -i %{key} -T git@github.com 2>&1 | grep successful > /dev/null',
|
61
|
+
copy_files: 'rsync -rl --exclude .git --delete "%{src_dir}/" .',
|
62
|
+
git_config_email: 'git config user.email %{quoted_email}',
|
63
|
+
git_config_name: 'git config user.name %{quoted_name}',
|
64
|
+
git_add: 'git add -A .',
|
65
|
+
git_commit_hook: 'cp %{path} .git/hooks/pre-commit',
|
66
|
+
git_commit: 'git commit %{git_commit_opts} -q %{git_commit_msg_opts}',
|
67
|
+
git_show: 'git show --stat-count=10 HEAD',
|
68
|
+
git_push: 'git push %{git_push_opts} --quiet "%{remote_url}" HEAD:"%{branch}" > /dev/null 2>&1'
|
69
|
+
|
70
|
+
errs copy_files: 'Failed to copy %{src_dir}.',
|
71
|
+
check_deploy_key: 'Failed to authenticate using the deploy key',
|
72
|
+
git_init: 'Failed to create new git repo',
|
73
|
+
git_push: 'Failed to push the build to %{url}:%{branch}'
|
72
74
|
|
73
75
|
def validate
|
74
76
|
error :same_branch if same_branch? && !allow_same_branch?
|
@@ -91,6 +93,7 @@ module Dpl
|
|
91
93
|
git_clone
|
92
94
|
copy_files
|
93
95
|
return info :stop unless git_dirty?
|
96
|
+
|
94
97
|
push
|
95
98
|
pull_request if pull_request?
|
96
99
|
end
|
@@ -107,163 +110,164 @@ module Dpl
|
|
107
110
|
|
108
111
|
private
|
109
112
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
113
|
+
def same_branch?
|
114
|
+
git_branch == branch
|
115
|
+
end
|
116
|
+
|
117
|
+
def login_token
|
118
|
+
return unless github?
|
119
|
+
|
120
|
+
info :login, user.login
|
121
|
+
error :insufficient_scopes unless sufficient_scopes?
|
122
|
+
rescue Octokit::Unauthorized => e
|
123
|
+
error :invalid_token, e.message
|
124
|
+
end
|
125
|
+
|
126
|
+
def setup_deploy_key
|
127
|
+
path = '~/.dpl/deploy_key'
|
128
|
+
info(:setup_deploy_key, path:)
|
129
|
+
mv deploy_key, path
|
130
|
+
chmod 0600, path
|
131
|
+
setup_git_ssh path
|
132
|
+
shell :check_deploy_key, key: path
|
133
|
+
end
|
134
|
+
|
135
|
+
def git_clone
|
136
|
+
shell :git_clone, echo: false
|
137
|
+
shell :git_branch unless branch_exists?
|
138
|
+
end
|
139
|
+
|
140
|
+
def clone_branch
|
141
|
+
branch_exists? ? branch : base_branch
|
142
|
+
end
|
143
|
+
|
144
|
+
def copy_files
|
145
|
+
shell :copy_files
|
146
|
+
end
|
147
|
+
|
148
|
+
def git_config
|
149
|
+
shell :git_config_name, echo: false
|
150
|
+
shell :git_config_email, echo: false
|
151
|
+
end
|
152
|
+
|
153
|
+
def branch_exists?
|
154
|
+
git_ls_remote?(remote_url, branch)
|
155
|
+
end
|
156
|
+
|
157
|
+
def git_commit
|
158
|
+
shell :git_commit_hook, path: asset(:git, :detect_private_key).path, echo: false if deploy_key?
|
159
|
+
shell :git_add
|
160
|
+
shell :git_commit
|
161
|
+
shell :git_show
|
162
|
+
end
|
163
|
+
|
164
|
+
def git_push
|
165
|
+
shell :git_push, echo: false
|
166
|
+
end
|
167
|
+
|
168
|
+
def git_push_opts
|
169
|
+
'--force' if force?
|
170
|
+
end
|
171
|
+
|
172
|
+
def git_commit_opts
|
173
|
+
' --allow-empty' if allow_empty_commit?
|
174
|
+
end
|
175
|
+
|
176
|
+
def git_commit_msg_opts
|
177
|
+
msg = interpolate(commit_message, vars:)
|
178
|
+
msg.split("\n").reject(&:empty?).map { |message| %(-m #{quote(message)}) }
|
179
|
+
end
|
180
|
+
|
181
|
+
def name
|
182
|
+
str = super if name?
|
183
|
+
str ||= user_name
|
184
|
+
str = "#{str} (via Travis CI)" if ENV['TRAVIS'] && !name?
|
185
|
+
str
|
186
|
+
end
|
187
|
+
memoize :name
|
188
|
+
|
189
|
+
def email
|
190
|
+
str = super if email?
|
191
|
+
str || user_email
|
192
|
+
end
|
193
|
+
memoize :email
|
194
|
+
|
195
|
+
def project_name
|
196
|
+
super || repo_slug
|
197
|
+
end
|
198
|
+
|
199
|
+
def remote_url
|
200
|
+
token? ? https_url_with_token : git_url
|
201
|
+
end
|
202
|
+
|
203
|
+
def https_url_with_token
|
204
|
+
"https://#{token}@#{url}"
|
205
|
+
end
|
206
|
+
|
207
|
+
def git_url
|
208
|
+
"git@#{host}:#{slug}.git"
|
209
|
+
end
|
210
|
+
|
211
|
+
def url
|
212
|
+
"#{host}/#{slug}.git"
|
213
|
+
end
|
214
|
+
|
215
|
+
def slug
|
216
|
+
repo || repo_slug
|
217
|
+
end
|
218
|
+
|
219
|
+
def src_dir
|
220
|
+
@src_dir ||= expand(local_dir)
|
221
|
+
end
|
222
|
+
|
223
|
+
def work_dir
|
224
|
+
@work_dir ||= tmp_dir
|
225
|
+
end
|
226
|
+
|
227
|
+
def sufficient_scopes?
|
228
|
+
scopes.include?('public_repo') || scopes.include?('repo')
|
229
|
+
end
|
230
|
+
|
231
|
+
def user
|
232
|
+
@user ||= github.user
|
233
|
+
end
|
234
|
+
|
235
|
+
def user_name
|
236
|
+
user.name || user.login
|
237
|
+
end
|
238
|
+
|
239
|
+
def user_email
|
240
|
+
user.email
|
241
|
+
end
|
242
|
+
|
243
|
+
def scopes
|
244
|
+
@scopes ||= github.scopes
|
245
|
+
end
|
246
|
+
|
247
|
+
def pr_exists?
|
248
|
+
!!github.pulls(repo).detect { |pull| pull.head.ref == branch }
|
249
|
+
end
|
250
|
+
|
251
|
+
def create_pr
|
252
|
+
pr = github.create_pull_request(repo, base_branch, branch, "Update #{base_branch}")
|
253
|
+
info :pr_created, number: pr.number
|
254
|
+
end
|
255
|
+
|
256
|
+
def github?
|
257
|
+
host.include?('github') || enterprise?
|
258
|
+
end
|
259
|
+
|
260
|
+
def github
|
261
|
+
@github ||= Octokit::Client.new(access_token: token, api_endpoint: api_url, auto_paginate: true)
|
262
|
+
end
|
263
|
+
|
264
|
+
def api_url
|
265
|
+
enterprise? ? "https://#{host}/api/v3/" : 'https://api.github.com/'
|
266
|
+
end
|
267
|
+
|
268
|
+
def now
|
269
|
+
Time.now
|
270
|
+
end
|
267
271
|
end
|
268
272
|
end
|
269
273
|
end
|
data/lib/dpl/providers/gleis.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Dpl
|
2
4
|
module Providers
|
3
5
|
class Gleis < Provider
|
@@ -5,9 +7,9 @@ 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
14
|
gem 'gleis', '~> 0.8.0'
|
13
15
|
|
@@ -21,20 +23,20 @@ module Dpl
|
|
21
23
|
|
22
24
|
needs :ssh_key
|
23
25
|
|
24
|
-
cmds login:
|
25
|
-
logout:
|
26
|
-
validate:
|
27
|
-
add_key:
|
26
|
+
cmds login: 'gleis auth login %{username} %{password} --skip-keygen',
|
27
|
+
logout: 'gleis auth logout',
|
28
|
+
validate: 'gleis app status -a %{app}',
|
29
|
+
add_key: 'gleis auth key add %{file} %{key_name}',
|
28
30
|
remove_key: 'gleis auth key remove %{key_name}',
|
29
|
-
git_url:
|
30
|
-
deploy:
|
31
|
+
git_url: 'gleis app git -a %{app} -q',
|
32
|
+
deploy: 'git push %{push_opts} -f %{git_url} HEAD:refs/heads/master'
|
31
33
|
|
32
|
-
errs login:
|
33
|
-
validate:
|
34
|
-
add_key:
|
34
|
+
errs login: 'Login failed',
|
35
|
+
validate: 'Application not found',
|
36
|
+
add_key: 'Adding SSH key failed',
|
35
37
|
remove_key: 'Removing key failed',
|
36
|
-
git_url:
|
37
|
-
deploy:
|
38
|
+
git_url: 'Failed to retrieve Git URL',
|
39
|
+
deploy: 'Deploying application failed'
|
38
40
|
|
39
41
|
attr_reader :git_url
|
40
42
|
|
@@ -51,7 +53,7 @@ module Dpl
|
|
51
53
|
end
|
52
54
|
|
53
55
|
def add_key(file)
|
54
|
-
shell :add_key, file:
|
56
|
+
shell :add_key, file:
|
55
57
|
end
|
56
58
|
|
57
59
|
def deploy
|
@@ -64,9 +66,9 @@ module Dpl
|
|
64
66
|
|
65
67
|
private
|
66
68
|
|
67
|
-
|
68
|
-
|
69
|
-
|
69
|
+
def push_opts
|
70
|
+
'-v' if verbose?
|
71
|
+
end
|
70
72
|
end
|
71
73
|
end
|
72
74
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Dpl
|
2
4
|
module Providers
|
3
5
|
class Hackage < Provider
|
@@ -5,9 +7,9 @@ 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
14
|
env :hackage
|
13
15
|
|
@@ -15,12 +17,12 @@ module Dpl
|
|
15
17
|
opt '--password USER', 'Hackage password', required: true, secret: true
|
16
18
|
opt '--publish', 'Whether or not to publish the package'
|
17
19
|
|
18
|
-
cmds check:
|
19
|
-
sdist:
|
20
|
+
cmds check: 'cabal check',
|
21
|
+
sdist: 'cabal sdist',
|
20
22
|
upload: 'cabal upload %{upload_opts} %{path}'
|
21
23
|
|
22
|
-
errs check:
|
23
|
-
sdist:
|
24
|
+
errs check: 'cabal check failed',
|
25
|
+
sdist: 'cabal sdist failed',
|
24
26
|
upload: 'cabal upload failed'
|
25
27
|
|
26
28
|
def validate
|
@@ -33,19 +35,19 @@ module Dpl
|
|
33
35
|
|
34
36
|
def deploy
|
35
37
|
tar_files.each do |path|
|
36
|
-
shell :upload, path:
|
38
|
+
shell :upload, path:
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
40
42
|
private
|
41
43
|
|
42
|
-
|
43
|
-
|
44
|
-
|
44
|
+
def upload_opts
|
45
|
+
opts_for(%i[publish username password])
|
46
|
+
end
|
45
47
|
|
46
|
-
|
47
|
-
|
48
|
-
|
48
|
+
def tar_files
|
49
|
+
Dir.glob('dist/*.tar.gz').sort
|
50
|
+
end
|
49
51
|
end
|
50
52
|
end
|
51
53
|
end
|
data/lib/dpl/providers/hephy.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Dpl
|
2
4
|
module Providers
|
3
5
|
class Hephy < Provider
|
@@ -5,9 +7,9 @@ module Dpl
|
|
5
7
|
|
6
8
|
status :beta
|
7
9
|
|
8
|
-
description sq(<<-
|
10
|
+
description sq(<<-STR)
|
9
11
|
tbd
|
10
|
-
|
12
|
+
STR
|
11
13
|
|
12
14
|
env :hephy
|
13
15
|
|
@@ -23,19 +25,19 @@ module Dpl
|
|
23
25
|
|
24
26
|
INSTALL = 'https://raw.githubusercontent.com/teamhephy/workflow-cli/master/install-v2.sh'
|
25
27
|
|
26
|
-
cmds install:
|
27
|
-
login:
|
28
|
-
add_key:
|
29
|
-
validate:
|
30
|
-
deploy:
|
31
|
-
run:
|
28
|
+
cmds install: 'curl -sSL %{INSTALL} | bash -x -s %{cli_version} && mv deis ~/.dpl',
|
29
|
+
login: 'deis login %{controller} --username=%{username} --password=%{password}',
|
30
|
+
add_key: 'deis keys:add %{key}',
|
31
|
+
validate: 'deis apps:info --app=%{app}',
|
32
|
+
deploy: 'filter_log git push %{verbose} %{url} HEAD:refs/heads/master -f',
|
33
|
+
run: 'deis run -a %{app} -- %{cmd}',
|
32
34
|
remove_key: 'deis keys:remove %{key_name}'
|
33
35
|
|
34
|
-
errs login:
|
35
|
-
add_key:
|
36
|
-
validate:
|
37
|
-
deploy:
|
38
|
-
run:
|
36
|
+
errs login: 'Login failed.',
|
37
|
+
add_key: 'Adding keys failed.',
|
38
|
+
validate: 'Application could not be verified.',
|
39
|
+
deploy: 'Deploying application failed.',
|
40
|
+
run: 'Running command failed.',
|
39
41
|
remove_key: 'Removing keys failed.'
|
40
42
|
|
41
43
|
def install
|
@@ -51,7 +53,7 @@ module Dpl
|
|
51
53
|
end
|
52
54
|
|
53
55
|
def add_key(key)
|
54
|
-
shell
|
56
|
+
shell(:add_key, key:)
|
55
57
|
wait_for_ssh_access(host, port)
|
56
58
|
end
|
57
59
|
|
@@ -64,7 +66,7 @@ module Dpl
|
|
64
66
|
end
|
65
67
|
|
66
68
|
def run_cmd(cmd)
|
67
|
-
shell :run, app
|
69
|
+
shell :run, app:, cmd:
|
68
70
|
end
|
69
71
|
|
70
72
|
def remove_key
|
@@ -94,7 +96,7 @@ module Dpl
|
|
94
96
|
end
|
95
97
|
|
96
98
|
def host
|
97
|
-
controller.gsub(
|
99
|
+
controller.gsub(%r{https?://}, '').split(':')[0]
|
98
100
|
end
|
99
101
|
|
100
102
|
def install_hephy_log_filter
|