dpl 2.0.3.beta.4 → 2.0.3.beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
# split this up to CodeDeploy::Github and CodeDeploy::S3 using the
|
|
@@ -9,12 +11,12 @@ module Dpl
|
|
|
9
11
|
|
|
10
12
|
full_name 'AWS Code Deploy'
|
|
11
13
|
|
|
12
|
-
description sq(<<-
|
|
14
|
+
description sq(<<-STR)
|
|
13
15
|
tbd
|
|
14
|
-
|
|
16
|
+
STR
|
|
15
17
|
|
|
16
18
|
gem 'aws-sdk-codedeploy', '~> 1.0'
|
|
17
|
-
gem 'aws-sdk-s3', '~> 1
|
|
19
|
+
gem 'aws-sdk-s3', '~> 1'
|
|
18
20
|
|
|
19
21
|
env :aws, :codedeploy
|
|
20
22
|
config '~/.aws/credentials', '~/.aws/config', prefix: 'aws'
|
|
@@ -23,28 +25,28 @@ module Dpl
|
|
|
23
25
|
opt '--secret_access_key KEY', 'AWS secret access key', required: true, secret: true
|
|
24
26
|
opt '--application NAME', 'CodeDeploy application name', required: true
|
|
25
27
|
opt '--deployment_group GROUP', 'CodeDeploy deployment group name'
|
|
26
|
-
opt '--revision_type TYPE', 'CodeDeploy revision type', enum: %w
|
|
28
|
+
opt '--revision_type TYPE', 'CodeDeploy revision type', enum: %w[s3 github], downcase: true
|
|
27
29
|
opt '--commit_id SHA', 'Commit ID in case of GitHub'
|
|
28
30
|
opt '--repository NAME', 'Repository name in case of GitHub'
|
|
29
31
|
opt '--bucket NAME', 'S3 bucket in case of S3'
|
|
30
32
|
opt '--region REGION', 'AWS availability zone', default: 'us-east-1'
|
|
31
|
-
opt '--file_exists_behavior STR', 'How to handle files that already exist in a deployment target location', enum: %w
|
|
33
|
+
opt '--file_exists_behavior STR', 'How to handle files that already exist in a deployment target location', enum: %w[disallow overwrite retain], default: 'disallow'
|
|
32
34
|
opt '--wait_until_deployed', 'Wait until the deployment has finished'
|
|
33
35
|
opt '--bundle_type TYPE', 'Bundle type of the revision'
|
|
34
36
|
opt '--key KEY', 'S3 bucket key of the revision'
|
|
35
37
|
opt '--description DESCR', 'Description of the revision', interpolate: true
|
|
36
38
|
opt '--endpoint ENDPOINT', 'S3 endpoint url'
|
|
37
39
|
|
|
38
|
-
msgs login:
|
|
39
|
-
deploy_triggered:
|
|
40
|
-
register_revision:
|
|
41
|
-
waiting_for_deploy:
|
|
42
|
-
finished_deploy:
|
|
43
|
-
description:
|
|
44
|
-
missing_bucket:
|
|
45
|
-
missing_key:
|
|
40
|
+
msgs login: 'Using Access Key: %{access_key_id}',
|
|
41
|
+
deploy_triggered: 'Deployment triggered: %s',
|
|
42
|
+
register_revision: 'Registering app revision with version=%s, etag=%s',
|
|
43
|
+
waiting_for_deploy: 'Waiting for the deployment to finish ',
|
|
44
|
+
finished_deploy: 'done: %s.',
|
|
45
|
+
description: 'Deploy build %{build_number} via Travis CI',
|
|
46
|
+
missing_bucket: 'Missing required bucket for S3 deployment',
|
|
47
|
+
missing_key: 'Missing required key for S3 deployment',
|
|
46
48
|
unknown_revision_type: 'Unknown revision type %p',
|
|
47
|
-
unknown_bundle_type:
|
|
49
|
+
unknown_bundle_type: 'Unknown bundle type'
|
|
48
50
|
|
|
49
51
|
vars :build_number
|
|
50
52
|
|
|
@@ -64,18 +66,18 @@ module Dpl
|
|
|
64
66
|
def register_revision
|
|
65
67
|
info :register_revision, revision_info[:version], revision_info[:e_tag]
|
|
66
68
|
code_deploy.register_application_revision(
|
|
67
|
-
revision
|
|
69
|
+
revision:,
|
|
68
70
|
application_name: application,
|
|
69
|
-
description:
|
|
71
|
+
description:
|
|
70
72
|
)
|
|
71
73
|
end
|
|
72
74
|
|
|
73
75
|
def create_deployment
|
|
74
76
|
deployment = code_deploy.create_deployment(
|
|
75
|
-
revision
|
|
77
|
+
revision:,
|
|
76
78
|
application_name: application,
|
|
77
79
|
deployment_group_name: deployment_group,
|
|
78
|
-
description
|
|
80
|
+
description:,
|
|
79
81
|
file_exists_behavior: file_exists_behavior.upcase
|
|
80
82
|
)
|
|
81
83
|
deployment.deployment_id
|
|
@@ -83,7 +85,7 @@ module Dpl
|
|
|
83
85
|
|
|
84
86
|
def wait_until_deployed(id)
|
|
85
87
|
print :waiting_for_deploy
|
|
86
|
-
status = poll(id) until %w
|
|
88
|
+
status = poll(id) until %w[Succeeded Failed Stopped].include?(status)
|
|
87
89
|
case status
|
|
88
90
|
when 'Succeeded'
|
|
89
91
|
info :finished_deploy, status
|
|
@@ -104,28 +106,28 @@ module Dpl
|
|
|
104
106
|
|
|
105
107
|
def revision
|
|
106
108
|
@revision ||= case revision_type
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
when 's3' then s3_revision
|
|
110
|
+
when 'github' then github_revision
|
|
111
|
+
when nil then bucket? ? s3_revision : github_revision
|
|
112
|
+
else error :unknown_revision_type, revision_type
|
|
113
|
+
end
|
|
112
114
|
end
|
|
113
115
|
|
|
114
116
|
def s3_revision
|
|
115
117
|
{
|
|
116
118
|
revision_type: 'S3',
|
|
117
119
|
s3_location: compact(
|
|
118
|
-
bucket
|
|
119
|
-
bundle_type
|
|
120
|
+
bucket:,
|
|
121
|
+
bundle_type:,
|
|
120
122
|
version: revision_version_info[:version_id],
|
|
121
123
|
e_tag: revision_version_info[:etag],
|
|
122
|
-
key:
|
|
124
|
+
key:
|
|
123
125
|
)
|
|
124
126
|
}
|
|
125
127
|
end
|
|
126
128
|
|
|
127
129
|
def revision_version_info
|
|
128
|
-
s3.head_object(bucket
|
|
130
|
+
s3.head_object(bucket:, key:)
|
|
129
131
|
rescue Aws::Errors::ServiceError => e
|
|
130
132
|
error e.message
|
|
131
133
|
end
|
|
@@ -134,8 +136,8 @@ module Dpl
|
|
|
134
136
|
{
|
|
135
137
|
revision_type: 'GitHub',
|
|
136
138
|
git_hub_location: {
|
|
137
|
-
commit_id
|
|
138
|
-
repository:
|
|
139
|
+
commit_id:,
|
|
140
|
+
repository:
|
|
139
141
|
}
|
|
140
142
|
}
|
|
141
143
|
end
|
|
@@ -157,11 +159,11 @@ module Dpl
|
|
|
157
159
|
end
|
|
158
160
|
|
|
159
161
|
def bundle_type
|
|
160
|
-
super || key =~ /\.(tar|tgz|zip)$/ &&
|
|
162
|
+
super || key =~ /\.(tar|tgz|zip)$/ && ::Regexp.last_match(1) || error(:unknown_bundle_type)
|
|
161
163
|
end
|
|
162
164
|
|
|
163
165
|
def description
|
|
164
|
-
interpolate(super || msg(:description), vars:
|
|
166
|
+
interpolate(super || msg(:description), vars:)
|
|
165
167
|
end
|
|
166
168
|
|
|
167
169
|
def build_number
|
|
@@ -177,7 +179,7 @@ module Dpl
|
|
|
177
179
|
end
|
|
178
180
|
|
|
179
181
|
def client_options
|
|
180
|
-
compact(region
|
|
182
|
+
compact(region:, credentials:, endpoint:)
|
|
181
183
|
end
|
|
182
184
|
|
|
183
185
|
def credentials
|
data/lib/dpl/providers/convox.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Dpl
|
|
2
4
|
module Providers
|
|
3
5
|
class Convox < Provider
|
|
@@ -5,9 +7,9 @@ module Dpl
|
|
|
5
7
|
|
|
6
8
|
status :dev
|
|
7
9
|
|
|
8
|
-
description sq(<<-
|
|
10
|
+
description sq(<<-STR)
|
|
9
11
|
tbd
|
|
10
|
-
|
|
12
|
+
STR
|
|
11
13
|
|
|
12
14
|
gem 'json'
|
|
13
15
|
|
|
@@ -30,21 +32,21 @@ module Dpl
|
|
|
30
32
|
opt '--prepare CMDS', 'Run commands with convox cli available just before deployment', type: :array
|
|
31
33
|
|
|
32
34
|
# if app and rack are exported to the env, do they need to be passed to these commands?
|
|
33
|
-
cmds login:
|
|
35
|
+
cmds login: 'convox version --rack %{rack}',
|
|
34
36
|
validate: 'convox apps info --rack %{rack} --app %{app}',
|
|
35
|
-
create:
|
|
36
|
-
update:
|
|
37
|
-
set_env:
|
|
38
|
-
build:
|
|
39
|
-
deploy:
|
|
40
|
-
|
|
41
|
-
msgs create:
|
|
42
|
-
missing:
|
|
37
|
+
create: 'convox apps create %{app} --generation %{generation} --rack %{rack} --wait',
|
|
38
|
+
update: 'convox update',
|
|
39
|
+
set_env: 'convox env set %{env} --rack %{rack} --app %{app} --replace',
|
|
40
|
+
build: 'convox build --rack %{rack} --app %{app} --id --description %{escaped_description}',
|
|
41
|
+
deploy: 'convox deploy --rack %{rack} --app %{app} --wait --id --description %{escaped_description}'
|
|
42
|
+
|
|
43
|
+
msgs create: 'Application %{app} does not exist on rack %{rack}. Creating it ...',
|
|
44
|
+
missing: 'Application %{app} does not exist on rack %{rack}.',
|
|
43
45
|
env_file: 'The given env_file does not exist.',
|
|
44
|
-
deploy:
|
|
45
|
-
build:
|
|
46
|
+
deploy: 'Building and promoting application ...',
|
|
47
|
+
build: 'Building application ...'
|
|
46
48
|
|
|
47
|
-
errs login:
|
|
49
|
+
errs login: 'Login failed.'
|
|
48
50
|
|
|
49
51
|
def install
|
|
50
52
|
script :install
|
|
@@ -86,23 +88,28 @@ module Dpl
|
|
|
86
88
|
|
|
87
89
|
def env_file
|
|
88
90
|
return [] unless env_file?
|
|
91
|
+
|
|
89
92
|
error :env_file unless file?(super)
|
|
90
93
|
lines = read(super).split("\n").map(&:strip)
|
|
91
94
|
lines.reject(&:empty?)
|
|
92
95
|
end
|
|
93
96
|
|
|
94
97
|
def description
|
|
95
|
-
description?
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
98
|
+
if description?
|
|
99
|
+
super
|
|
100
|
+
else
|
|
101
|
+
JSON.dump(
|
|
102
|
+
repo_slug:,
|
|
103
|
+
git_commit_sha: git_sha,
|
|
104
|
+
git_commit_message: git_commit_msg,
|
|
105
|
+
git_commit_author: git_author_name,
|
|
106
|
+
git_tag:,
|
|
107
|
+
branch: git_branch,
|
|
108
|
+
travis_build_id: ENV['TRAVIS_BUILD_ID'],
|
|
109
|
+
travis_build_number: ENV['TRAVIS_BUILD_NUMBER'],
|
|
110
|
+
pull_request: ENV['TRAVIS_PULL_REQUEST']
|
|
111
|
+
)
|
|
112
|
+
end
|
|
106
113
|
end
|
|
107
114
|
|
|
108
115
|
def export
|
data/lib/dpl/providers/datica.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Dpl
|
|
2
4
|
module Providers
|
|
3
5
|
class Datica < Provider
|
|
@@ -7,9 +9,9 @@ module Dpl
|
|
|
7
9
|
|
|
8
10
|
register :datica, :catalyze
|
|
9
11
|
|
|
10
|
-
description sq(<<-
|
|
12
|
+
description sq(<<-STR)
|
|
11
13
|
tbd
|
|
12
|
-
|
|
14
|
+
STR
|
|
13
15
|
|
|
14
16
|
env :datica, :catalyze
|
|
15
17
|
|
|
@@ -19,12 +21,12 @@ module Dpl
|
|
|
19
21
|
needs :git
|
|
20
22
|
|
|
21
23
|
cmds checkout: 'git checkout HEAD',
|
|
22
|
-
add:
|
|
23
|
-
commit:
|
|
24
|
-
push:
|
|
24
|
+
add: 'git add %{path} --all --force',
|
|
25
|
+
commit: 'git commit -m "%{message}" --quiet',
|
|
26
|
+
push: 'git push --force %{target} HEAD:master'
|
|
25
27
|
|
|
26
|
-
msgs commit:
|
|
27
|
-
push:
|
|
28
|
+
msgs commit: 'Committing build files for deployment',
|
|
29
|
+
push: 'Deploying to Datica: %{target}'
|
|
28
30
|
|
|
29
31
|
def setup
|
|
30
32
|
commit if git_dirty? && !cleanup?
|
|
@@ -36,27 +38,27 @@ module Dpl
|
|
|
36
38
|
|
|
37
39
|
private
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
41
|
+
def commit
|
|
42
|
+
info :commit
|
|
43
|
+
shell :checkout
|
|
44
|
+
shell :add
|
|
45
|
+
shell :commit
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def message
|
|
49
|
+
vars.empty? ? 'Local build' : 'Build #%s (%s) of %s@%s' % vars
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
VARS = %w[
|
|
53
|
+
TRAVIS_BUILD_NUMBER
|
|
54
|
+
TRAVIS_COMMIT
|
|
55
|
+
TRAVIS_REPO_SLUG
|
|
56
|
+
TRAVIS_BRANCH
|
|
57
|
+
].freeze
|
|
58
|
+
|
|
59
|
+
def vars
|
|
60
|
+
@vars ||= ENV.values_at(*VARS).compact
|
|
61
|
+
end
|
|
60
62
|
end
|
|
61
63
|
end
|
|
62
64
|
end
|
data/lib/dpl/providers/ecr.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Dpl
|
|
2
4
|
module Providers
|
|
3
5
|
class Ecr < Provider
|
|
@@ -5,9 +7,9 @@ module Dpl
|
|
|
5
7
|
|
|
6
8
|
full_name 'AWS ECR'
|
|
7
9
|
|
|
8
|
-
description sq(<<-
|
|
10
|
+
description sq(<<-STR)
|
|
9
11
|
tbd
|
|
10
|
-
|
|
12
|
+
STR
|
|
11
13
|
|
|
12
14
|
gem 'aws-sdk-ecr', '~> 1.0'
|
|
13
15
|
# gem 'docker-api', '~> 1.34'
|
|
@@ -22,14 +24,14 @@ module Dpl
|
|
|
22
24
|
opt '--target TARGET', 'Comma separated list of partial repository names to push to', eg: 'image-one:tag,image-two', required: true
|
|
23
25
|
opt '--region REGION', 'Comma separated list of regions to push to', default: 'us-east-1'
|
|
24
26
|
|
|
25
|
-
msgs login:
|
|
26
|
-
auth_region:
|
|
27
|
-
deploy:
|
|
27
|
+
msgs login: 'Using Access Key: %{access_key_id}',
|
|
28
|
+
auth_region: 'Authenticated with %{url}',
|
|
29
|
+
deploy: 'Pushing image %{source} to regions %{regions} as %{targets}',
|
|
28
30
|
image_pushed: 'Pushed image %{source} to region %{region} as %{target}'
|
|
29
31
|
|
|
30
32
|
cmds login: 'docker login -u %{user} -p %{pass} %{url}',
|
|
31
|
-
tag:
|
|
32
|
-
push:
|
|
33
|
+
tag: 'docker tag %{source} %{url}/%{repo}:%{tag}',
|
|
34
|
+
push: 'docker push %{url}/%{repo}'
|
|
33
35
|
|
|
34
36
|
errs unknown_image: 'Image %{source} not found in the local Docker repository'
|
|
35
37
|
|
|
@@ -41,7 +43,7 @@ module Dpl
|
|
|
41
43
|
end
|
|
42
44
|
|
|
43
45
|
def validate
|
|
44
|
-
# TODO validate the image exists locally
|
|
46
|
+
# TODO: validate the image exists locally
|
|
45
47
|
end
|
|
46
48
|
|
|
47
49
|
def deploy
|
|
@@ -53,75 +55,75 @@ module Dpl
|
|
|
53
55
|
|
|
54
56
|
private
|
|
55
57
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
def push(region, target)
|
|
59
|
+
url, repo, tag = endpoints[region], *target.split(':')
|
|
60
|
+
shell :tag, url:, repo:, tag: tag || 'latest'
|
|
61
|
+
shell(:push, url:, repo:)
|
|
62
|
+
info :image_pushed, region:, target:
|
|
63
|
+
end
|
|
62
64
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
def auth_regions
|
|
66
|
+
@endpoints = regions.map { |region| [region, auth_region(region)] }.to_h
|
|
67
|
+
end
|
|
66
68
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
def auth_region(region)
|
|
70
|
+
token = auth_token(region)
|
|
71
|
+
user, pass = parse_auth(token.authorization_token)
|
|
72
|
+
url = token.proxy_endpoint
|
|
73
|
+
shell :login, user:, pass:, url:, echo: false, silent: true
|
|
74
|
+
info(:auth_region, url:)
|
|
75
|
+
strip_protocol(url)
|
|
76
|
+
end
|
|
75
77
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
def auth_token(region)
|
|
79
|
+
ecr(region).get_authorization_token(registry_ids).authorization_data[0]
|
|
80
|
+
end
|
|
79
81
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
def registry_ids
|
|
83
|
+
account_id? ? { registry_ids: [account_id] } : {}
|
|
84
|
+
end
|
|
83
85
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
def regions
|
|
87
|
+
# not sure how this was meant to be normalized when being a YAML list
|
|
88
|
+
region.split(',')
|
|
89
|
+
end
|
|
88
90
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
def targets
|
|
92
|
+
# not sure how this was meant to be normalized when being a YAML list
|
|
93
|
+
target.split(',')
|
|
94
|
+
end
|
|
93
95
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
def creds
|
|
97
|
+
@creds ||= only(opts, :access_key_id, :secret_access_key)
|
|
98
|
+
end
|
|
97
99
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
def ecr(region)
|
|
101
|
+
Aws::ECR::Client.new(region:, **creds)
|
|
102
|
+
end
|
|
101
103
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
def parse_auth(str)
|
|
105
|
+
user, pass = Base64.decode64(str).split(':')
|
|
106
|
+
[user, pass.chomp]
|
|
107
|
+
end
|
|
106
108
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
def strip_protocol(url)
|
|
110
|
+
url.sub(%r{^https?://}, '')
|
|
111
|
+
end
|
|
110
112
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
end
|
|
113
|
+
def progress(events)
|
|
114
|
+
events.split("\r\n").each do |event|
|
|
115
|
+
event = JSON.parse(event)
|
|
116
|
+
if e = event['error']
|
|
117
|
+
error e
|
|
118
|
+
elsif %w[Preparing Pushing].include?(event['status'])
|
|
119
|
+
nil
|
|
120
|
+
elsif event['id']
|
|
121
|
+
info "#{event['status']} [#{event['id']}]"
|
|
122
|
+
elsif event['status']
|
|
123
|
+
info event['status']
|
|
123
124
|
end
|
|
124
125
|
end
|
|
126
|
+
end
|
|
125
127
|
end
|
|
126
128
|
end
|
|
127
129
|
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Dpl
|
|
2
4
|
module Providers
|
|
3
5
|
class Elasticbeanstalk < Provider
|
|
@@ -7,7 +9,7 @@ module Dpl
|
|
|
7
9
|
|
|
8
10
|
full_name 'AWS Elastic Beanstalk'
|
|
9
11
|
|
|
10
|
-
description sq(<<-
|
|
12
|
+
description sq(<<-STR)
|
|
11
13
|
Deploy to AWS Elastic Beanstalk: https://aws.amazon.com/elasticbeanstalk/
|
|
12
14
|
|
|
13
15
|
This provider:
|
|
@@ -16,12 +18,12 @@ module Dpl
|
|
|
16
18
|
* Uploads it to your EB application
|
|
17
19
|
* Optionally deploys to a specific EB environment
|
|
18
20
|
* Optionally waits until the deployment finishes
|
|
19
|
-
|
|
21
|
+
STR
|
|
20
22
|
|
|
21
|
-
gem 'aws-sdk-elasticbeanstalk', '~> 1
|
|
22
|
-
gem 'aws-sdk-s3', '~> 1
|
|
23
|
-
gem 'rubyzip', '~>
|
|
24
|
-
gem 'pathspec', '~>
|
|
23
|
+
gem 'aws-sdk-elasticbeanstalk', '~> 1'
|
|
24
|
+
gem 'aws-sdk-s3', '~> 1'
|
|
25
|
+
gem 'rubyzip', '~> 2.3', require: 'zip'
|
|
26
|
+
gem 'pathspec', '~> 1.1', require: 'pathspec'
|
|
25
27
|
|
|
26
28
|
env :aws, :elastic_beanstalk
|
|
27
29
|
config '~/.aws/credentials', '~/.aws/config', prefix: 'aws'
|
|
@@ -40,7 +42,7 @@ module Dpl
|
|
|
40
42
|
opt '--wait_until_deployed_timeout SEC', 'How many seconds to wait for Elastic Beanstalk deployment update.', type: :integer, default: 600
|
|
41
43
|
opt '--debug', internal: true
|
|
42
44
|
|
|
43
|
-
msgs login:
|
|
45
|
+
msgs login: 'Using Access Key: %{access_key_id}',
|
|
44
46
|
zip_add: 'Adding %s'
|
|
45
47
|
|
|
46
48
|
msgs clean_description: 'Removed non-printable characters from the version description'
|
|
@@ -53,7 +55,7 @@ module Dpl
|
|
|
53
55
|
|
|
54
56
|
def setup
|
|
55
57
|
info :login
|
|
56
|
-
Aws.config.update(credentials
|
|
58
|
+
Aws.config.update(credentials:, region:)
|
|
57
59
|
end
|
|
58
60
|
|
|
59
61
|
def deploy
|
|
@@ -82,7 +84,7 @@ module Dpl
|
|
|
82
84
|
end
|
|
83
85
|
|
|
84
86
|
def bucket_path
|
|
85
|
-
bucket_path? ? "#{super.gsub(
|
|
87
|
+
bucket_path? ? "#{super.gsub(%r{/*$}, '')}/#{archive_name}" : archive_name
|
|
86
88
|
end
|
|
87
89
|
|
|
88
90
|
def cwd
|
|
@@ -90,7 +92,7 @@ module Dpl
|
|
|
90
92
|
end
|
|
91
93
|
|
|
92
94
|
def zip_exists?
|
|
93
|
-
File.
|
|
95
|
+
File.exist?(zip_file)
|
|
94
96
|
end
|
|
95
97
|
|
|
96
98
|
def create_zip
|
|
@@ -150,7 +152,7 @@ module Dpl
|
|
|
150
152
|
|
|
151
153
|
def files
|
|
152
154
|
files = Dir.glob('**/*', File::FNM_DOTMATCH)
|
|
153
|
-
ignore = %w
|
|
155
|
+
ignore = %w[.ebignore .gitignore].detect { |file| file?(file) }
|
|
154
156
|
files = filter(files, ignore) if ignore
|
|
155
157
|
files
|
|
156
158
|
end
|
|
@@ -198,7 +200,7 @@ module Dpl
|
|
|
198
200
|
end
|
|
199
201
|
|
|
200
202
|
def debug(*args)
|
|
201
|
-
info
|
|
203
|
+
info(*args) if debug?
|
|
202
204
|
end
|
|
203
205
|
end
|
|
204
206
|
end
|