dpl 2.0.0.beta.2 → 2.0.3.beta.2
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/CHANGELOG.md +18 -0
- data/CONTRIBUTING.md +3 -3
- data/Gemfile +1 -1
- data/Gemfile.lock +118 -99
- data/README.md +203 -41
- data/lib/dpl/assets/dpl/README.erb.md +3 -3
- data/lib/dpl/assets/dpl/git_ssh +7 -1
- data/lib/dpl/cli.rb +1 -1
- data/lib/dpl/helper/interpolate.rb +11 -4
- data/lib/dpl/provider.rb +1 -1
- data/lib/dpl/providers/bluemixcloudfoundry.rb +1 -1
- data/lib/dpl/providers/boxfuse.rb +1 -1
- data/lib/dpl/providers/cloudfoundry.rb +3 -1
- data/lib/dpl/providers/codedeploy.rb +7 -2
- data/lib/dpl/providers/ecr.rb +127 -0
- data/lib/dpl/providers/elasticbeanstalk.rb +12 -6
- data/lib/dpl/providers/gcs.rb +1 -1
- data/lib/dpl/providers/git_push.rb +269 -0
- data/lib/dpl/providers/gleis.rb +1 -1
- data/lib/dpl/providers/lambda.rb +1 -1
- data/lib/dpl/providers/netlify.rb +2 -0
- data/lib/dpl/providers/nuget.rb +39 -0
- data/lib/dpl/providers/pages/git.rb +5 -4
- data/lib/dpl/providers/puppetforge.rb +2 -2
- data/lib/dpl/providers/releases.rb +1 -1
- data/lib/dpl/providers/rubygems.rb +2 -2
- data/lib/dpl/providers/snap.rb +1 -1
- data/lib/dpl/providers.rb +3 -0
- data/lib/dpl/string_ext.rb +21 -0
- data/lib/dpl/version.rb +1 -1
- data/lib/dpl.rb +1 -0
- metadata +9 -8
- data/NOTES.md +0 -78
- data/dpl-chef_supermarket-1.10.14.gem +0 -0
- data/dpl.gemspec +0 -22
- data/status.json +0 -227
@@ -0,0 +1,127 @@
|
|
1
|
+
module Dpl
|
2
|
+
module Providers
|
3
|
+
class Ecr < Provider
|
4
|
+
status :alpha
|
5
|
+
|
6
|
+
full_name 'AWS ECR'
|
7
|
+
|
8
|
+
description sq(<<-str)
|
9
|
+
tbd
|
10
|
+
str
|
11
|
+
|
12
|
+
gem 'aws-sdk-ecr', '~> 1.0'
|
13
|
+
# gem 'docker-api', '~> 1.34'
|
14
|
+
gem 'json'
|
15
|
+
|
16
|
+
env :aws
|
17
|
+
|
18
|
+
opt '--access_key_id ID', 'AWS access key', required: true, secret: true
|
19
|
+
opt '--secret_access_key KEY', 'AWS secret access key', required: true, secret: true
|
20
|
+
opt '--account_id ID', 'AWS Account ID', note: 'Required if the repository is owned by a different account than the IAM user'
|
21
|
+
opt '--source SOURCE', 'Image to push', note: 'can be the id or the name and optional tag (e.g. mysql:5.6)', required: true
|
22
|
+
opt '--target TARGET', 'Comma separated list of partial repository names to push to', eg: 'image-one:tag,image-two', required: true
|
23
|
+
opt '--region REGION', 'Comma separated list of regions to push to', default: 'us-east-1'
|
24
|
+
|
25
|
+
msgs login: 'Using Access Key: %{access_key_id}',
|
26
|
+
auth_region: 'Authenticated with %{url}',
|
27
|
+
deploy: 'Pushing image %{source} to regions %{regions} as %{targets}',
|
28
|
+
image_pushed: 'Pushed image %{source} to region %{region} as %{target}'
|
29
|
+
|
30
|
+
cmds login: 'docker login -u %{user} -p %{pass} %{url}',
|
31
|
+
tag: 'docker tag %{source} %{url}/%{repo}:%{tag}',
|
32
|
+
push: 'docker push %{url}/%{repo}'
|
33
|
+
|
34
|
+
errs unknown_image: 'Image %{source} not found in the local Docker repository'
|
35
|
+
|
36
|
+
attr_reader :endpoints
|
37
|
+
|
38
|
+
def login
|
39
|
+
info :login
|
40
|
+
auth_regions
|
41
|
+
end
|
42
|
+
|
43
|
+
def validate
|
44
|
+
# TODO validate the image exists locally
|
45
|
+
end
|
46
|
+
|
47
|
+
def deploy
|
48
|
+
info :deploy, regions: regions.join(', '), targets: targets.join(', ')
|
49
|
+
regions.product(targets).each do |region, target|
|
50
|
+
push(region, target)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def push(region, target)
|
57
|
+
url, repo, tag = endpoints[region], *target.split(':')
|
58
|
+
shell :tag, url: url, repo: repo, tag: tag || 'latest'
|
59
|
+
shell :push, url: url, repo: repo
|
60
|
+
info :image_pushed, region: region, target: target
|
61
|
+
end
|
62
|
+
|
63
|
+
def auth_regions
|
64
|
+
@endpoints = regions.map { |region| [region, auth_region(region)] }.to_h
|
65
|
+
end
|
66
|
+
|
67
|
+
def auth_region(region)
|
68
|
+
token = auth_token(region)
|
69
|
+
user, pass = parse_auth(token.authorization_token)
|
70
|
+
url = token.proxy_endpoint
|
71
|
+
shell :login, user: user, pass: pass, url: url, echo: false, silent: true
|
72
|
+
info :auth_region, url: url
|
73
|
+
strip_protocol(url)
|
74
|
+
end
|
75
|
+
|
76
|
+
def auth_token(region)
|
77
|
+
ecr(region).get_authorization_token(registry_ids).authorization_data[0]
|
78
|
+
end
|
79
|
+
|
80
|
+
def registry_ids
|
81
|
+
account_id? ? { registry_ids: [account_id] } : {}
|
82
|
+
end
|
83
|
+
|
84
|
+
def regions
|
85
|
+
# not sure how this was meant to be normalized when being a YAML list
|
86
|
+
region.split(',')
|
87
|
+
end
|
88
|
+
|
89
|
+
def targets
|
90
|
+
# not sure how this was meant to be normalized when being a YAML list
|
91
|
+
target.split(',')
|
92
|
+
end
|
93
|
+
|
94
|
+
def creds
|
95
|
+
@creds ||= only(opts, :access_key_id, :secret_access_key)
|
96
|
+
end
|
97
|
+
|
98
|
+
def ecr(region)
|
99
|
+
Aws::ECR::Client.new(region: region, **creds)
|
100
|
+
end
|
101
|
+
|
102
|
+
def parse_auth(str)
|
103
|
+
user, pass = Base64.decode64(str).split(':')
|
104
|
+
[user, pass.chomp]
|
105
|
+
end
|
106
|
+
|
107
|
+
def strip_protocol(url)
|
108
|
+
url.sub(/^https?:\/\//, '')
|
109
|
+
end
|
110
|
+
|
111
|
+
def progress(events)
|
112
|
+
events.split("\r\n").each do |event|
|
113
|
+
event = JSON.parse(event)
|
114
|
+
if e = event['error']
|
115
|
+
error e
|
116
|
+
elsif %w(Preparing Pushing).include?(event['status'])
|
117
|
+
nil
|
118
|
+
elsif event['id']
|
119
|
+
info "#{event['status']} [#{event['id']}]"
|
120
|
+
elsif event['status']
|
121
|
+
info event['status']
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -8,7 +8,14 @@ module Dpl
|
|
8
8
|
full_name 'AWS Elastic Beanstalk'
|
9
9
|
|
10
10
|
description sq(<<-str)
|
11
|
-
|
11
|
+
Deploy to AWS Elastic Beanstalk: https://aws.amazon.com/elasticbeanstalk/
|
12
|
+
|
13
|
+
This provider:
|
14
|
+
|
15
|
+
* Creates a zip file (or uses one you provide)
|
16
|
+
* Uploads it to your EB application
|
17
|
+
* Optionally deploys to a specific EB environment
|
18
|
+
* Optionally waits until the deployment finishes
|
12
19
|
str
|
13
20
|
|
14
21
|
gem 'aws-sdk-elasticbeanstalk', '~> 1.0'
|
@@ -23,14 +30,13 @@ module Dpl
|
|
23
30
|
opt '--secret_access_key KEY', 'AWS Secret Key', required: true, secret: true
|
24
31
|
opt '--region REGION', 'AWS Region the Elastic Beanstalk app is running in', default: 'us-east-1'
|
25
32
|
opt '--app NAME', 'Elastic Beanstalk application name', default: :repo_name
|
26
|
-
opt '--env NAME', 'Elastic Beanstalk environment name
|
33
|
+
opt '--env NAME', 'Elastic Beanstalk environment name to be updated.'
|
27
34
|
opt '--bucket NAME', 'Bucket name to upload app to', required: true, alias: :bucket_name
|
28
35
|
opt '--bucket_path PATH', 'Location within Bucket to upload app to'
|
29
36
|
opt '--description DESC', 'Description for the application version'
|
30
37
|
opt '--label LABEL', 'Label for the application version'
|
31
|
-
opt '--zip_file PATH', 'The zip file that you want to deploy'
|
32
|
-
opt '--
|
33
|
-
opt '--wait_until_deployed', 'Wait until the deployment has finished'
|
38
|
+
opt '--zip_file PATH', 'The zip file that you want to deploy. If not given, a zipfile will be created from the current directory, honoring .ebignore and .gitignore.'
|
39
|
+
opt '--wait_until_deployed', 'Wait until the deployment has finished', requires: :env
|
34
40
|
opt '--wait_until_deployed_timeout SEC', 'How many seconds to wait for Elastic Beanstalk deployment update.', type: :integer, default: 600
|
35
41
|
opt '--debug', internal: true
|
36
42
|
|
@@ -56,7 +62,7 @@ module Dpl
|
|
56
62
|
create_zip unless zip_exists?
|
57
63
|
upload
|
58
64
|
create_version
|
59
|
-
update_app
|
65
|
+
update_app if env?
|
60
66
|
end
|
61
67
|
|
62
68
|
def zip_file
|
data/lib/dpl/providers/gcs.rb
CHANGED
@@ -33,7 +33,7 @@ module Dpl
|
|
33
33
|
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
34
|
opt '--glob GLOB', default: '**/*'
|
35
35
|
|
36
|
-
cmds install: 'curl -L %{URL} | tar xz -C ~ && ~/google-cloud-sdk/install.sh --path-update false --usage-reporting false --command-completion false',
|
36
|
+
cmds install: 'curl -L %{URL} | tar xz -C ~ && ~/google-cloud-sdk/install.sh --quiet --path-update false --usage-reporting false --command-completion false',
|
37
37
|
login_key: 'gcloud auth activate-service-account --key-file=%{key_file}',
|
38
38
|
rsync: 'gsutil %{gs_opts} rsync %{rsync_opts} %{glob} %{target}',
|
39
39
|
copy: 'gsutil %{gs_opts} cp %{copy_opts} -r %{source} %{target}'
|
@@ -0,0 +1,269 @@
|
|
1
|
+
module Dpl
|
2
|
+
module Providers
|
3
|
+
class GitPush < Provider
|
4
|
+
register :git_push
|
5
|
+
|
6
|
+
status :dev
|
7
|
+
|
8
|
+
full_name 'Git (push)'
|
9
|
+
|
10
|
+
description sq(<<-str)
|
11
|
+
Experimental, generic provider for updating a Git remote branch with
|
12
|
+
changes produced by the build, and optionally opening a pull request.
|
13
|
+
str
|
14
|
+
|
15
|
+
gem 'octokit', '~> 4.15.0'
|
16
|
+
gem 'public_suffix', '~> 3.0.3'
|
17
|
+
|
18
|
+
env :github, :git
|
19
|
+
|
20
|
+
required :token, [:deploy_key, :name, :email]
|
21
|
+
|
22
|
+
opt '--repo SLUG', 'Repo slug', default: :repo_slug
|
23
|
+
opt '--token TOKEN', 'GitHub token with repo permission', secret: true, alias: :github_token
|
24
|
+
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
|
+
opt '--branch BRANCH', 'Target branch to push to', required: true
|
26
|
+
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' #, default: :user_name
|
28
|
+
opt '--email EMAIL', 'Committer email', note: 'defaults to the GitHub email associated with the GitHub token' #, default: :user_email
|
29
|
+
opt '--commit_message MSG', default: 'Update %{base_branch}', interpolate: true
|
30
|
+
opt '--allow_empty_commit', 'Allow an empty commit to be created'
|
31
|
+
opt '--force', 'Whether to push --force', default: false
|
32
|
+
opt '--local_dir DIR', 'Local directory to push', default: '.'
|
33
|
+
opt '--pull_request', 'Whether to create a pull request for the given branch'
|
34
|
+
opt '--allow_same_branch', 'Whether to allow pushing to the same branch as the current branch', default: false, note: 'setting this to true risks creating infinite build loops, use conditional builds or other mechanisms to prevent build from infinitely triggering more builds'
|
35
|
+
opt '--host HOST', default: 'github.com'
|
36
|
+
opt '--enterprise', 'Whether to use a GitHub Enterprise API style URL'
|
37
|
+
|
38
|
+
needs :git
|
39
|
+
|
40
|
+
msgs login: 'Authenticated as %s',
|
41
|
+
invalid_token: 'The provided GitHub token is invalid (error: %s)',
|
42
|
+
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: '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.',
|
44
|
+
setup_deploy_key: 'Moving deploy key %{deploy_key} to %{path}',
|
45
|
+
check_deploy_key: 'Checking deploy key',
|
46
|
+
setup: 'Source dir: %{src_dir}, branch: %{branch}, base branch: %{base_branch}',
|
47
|
+
git_clone: 'Cloning the branch %{branch} to %{work_dir}',
|
48
|
+
git_branch: 'Switching to branch %{branch}',
|
49
|
+
copy_files: 'Copying %{src_dir} contents to %{work_dir}',
|
50
|
+
git_config: 'Configuring git committer to be: %{name} <%{email}>',
|
51
|
+
git_push: 'Pushing to %{url} HEAD:%{branch}',
|
52
|
+
pr_exists: 'Pull request exists.',
|
53
|
+
pr_created: 'Pull request #%{number} created.',
|
54
|
+
stop: 'There are no changes to commit, stopping.'
|
55
|
+
|
56
|
+
cmds git_clone: 'git clone --quiet --branch="%{clone_branch}" "%{remote_url}" . > /dev/null 2>&1',
|
57
|
+
git_branch: 'git checkout -b "%{branch}"',
|
58
|
+
check_deploy_key: 'ssh -i %{key} -T git@github.com 2>&1 | grep successful > /dev/null',
|
59
|
+
copy_files: 'rsync -rl --exclude .git --delete "%{src_dir}/" .',
|
60
|
+
git_config_email: 'git config user.email %{quoted_email}',
|
61
|
+
git_config_name: 'git config user.name %{quoted_name}',
|
62
|
+
git_add: 'git add -A .',
|
63
|
+
git_commit_hook: 'cp %{path} .git/hooks/pre-commit',
|
64
|
+
git_commit: 'git commit %{git_commit_opts} -q %{git_commit_msg_opts}',
|
65
|
+
git_show: 'git show --stat-count=10 HEAD',
|
66
|
+
git_push: 'git push %{git_push_opts} --quiet "%{remote_url}" HEAD:"%{branch}" > /dev/null 2>&1'
|
67
|
+
|
68
|
+
errs copy_files: 'Failed to copy %{src_dir}.',
|
69
|
+
check_deploy_key: 'Failed to authenticate using the deploy key',
|
70
|
+
git_init: 'Failed to create new git repo',
|
71
|
+
git_push: 'Failed to push the build to %{url}:%{branch}'
|
72
|
+
|
73
|
+
def validate
|
74
|
+
error :same_branch if same_branch? && !allow_same_branch?
|
75
|
+
end
|
76
|
+
|
77
|
+
def setup
|
78
|
+
info :setup
|
79
|
+
info :git_config
|
80
|
+
end
|
81
|
+
|
82
|
+
def login
|
83
|
+
token? ? login_token : setup_deploy_key
|
84
|
+
end
|
85
|
+
|
86
|
+
def prepare
|
87
|
+
Dir.chdir(work_dir)
|
88
|
+
end
|
89
|
+
|
90
|
+
def deploy
|
91
|
+
git_clone
|
92
|
+
copy_files
|
93
|
+
return info :stop unless git_dirty?
|
94
|
+
push
|
95
|
+
pull_request if pull_request?
|
96
|
+
end
|
97
|
+
|
98
|
+
def push
|
99
|
+
git_config
|
100
|
+
git_commit
|
101
|
+
git_push
|
102
|
+
end
|
103
|
+
|
104
|
+
def pull_request
|
105
|
+
pr_exists? ? info(:pr_exists) : create_pr
|
106
|
+
end
|
107
|
+
|
108
|
+
private
|
109
|
+
|
110
|
+
def same_branch?
|
111
|
+
git_branch == branch
|
112
|
+
end
|
113
|
+
|
114
|
+
def login_token
|
115
|
+
return unless github?
|
116
|
+
info :login, user.login
|
117
|
+
error :insufficient_scopes unless sufficient_scopes?
|
118
|
+
rescue Octokit::Unauthorized => e
|
119
|
+
error :invalid_token, e.message
|
120
|
+
end
|
121
|
+
|
122
|
+
def setup_deploy_key
|
123
|
+
path = '~/.dpl/deploy_key'
|
124
|
+
info :setup_deploy_key, path: path
|
125
|
+
mv deploy_key, path
|
126
|
+
chmod 0600, path
|
127
|
+
setup_git_ssh path
|
128
|
+
shell :check_deploy_key, key: path
|
129
|
+
end
|
130
|
+
|
131
|
+
def git_clone
|
132
|
+
shell :git_clone, echo: false
|
133
|
+
shell :git_branch unless branch_exists?
|
134
|
+
end
|
135
|
+
|
136
|
+
def clone_branch
|
137
|
+
branch_exists? ? branch : base_branch
|
138
|
+
end
|
139
|
+
|
140
|
+
def copy_files
|
141
|
+
shell :copy_files
|
142
|
+
end
|
143
|
+
|
144
|
+
def git_config
|
145
|
+
shell :git_config_name, echo: false
|
146
|
+
shell :git_config_email, echo: false
|
147
|
+
end
|
148
|
+
|
149
|
+
def branch_exists?
|
150
|
+
git_ls_remote?(remote_url, branch)
|
151
|
+
end
|
152
|
+
|
153
|
+
def git_commit
|
154
|
+
shell :git_commit_hook, path: asset(:git, :detect_private_key).path, echo: false if deploy_key?
|
155
|
+
shell :git_add
|
156
|
+
shell :git_commit
|
157
|
+
shell :git_show
|
158
|
+
end
|
159
|
+
|
160
|
+
def git_push
|
161
|
+
shell :git_push, echo: false
|
162
|
+
end
|
163
|
+
|
164
|
+
def git_push_opts
|
165
|
+
'--force' if force?
|
166
|
+
end
|
167
|
+
|
168
|
+
def git_commit_opts
|
169
|
+
' --allow-empty' if allow_empty_commit?
|
170
|
+
end
|
171
|
+
|
172
|
+
def git_commit_msg_opts
|
173
|
+
msg = interpolate(commit_message, vars: vars)
|
174
|
+
msg.split("\n").reject(&:empty?).map { |msg| %(-m #{quote(msg)}) }
|
175
|
+
end
|
176
|
+
|
177
|
+
def name
|
178
|
+
str = super if name?
|
179
|
+
str ||= user_name
|
180
|
+
str = "#{str} (via Travis CI)" if ENV['TRAVIS'] && !name?
|
181
|
+
str
|
182
|
+
end
|
183
|
+
memoize :name
|
184
|
+
|
185
|
+
def email
|
186
|
+
str = super if email?
|
187
|
+
str || user_email
|
188
|
+
end
|
189
|
+
memoize :email
|
190
|
+
|
191
|
+
def project_name
|
192
|
+
super || repo_slug
|
193
|
+
end
|
194
|
+
|
195
|
+
def remote_url
|
196
|
+
token? ? https_url_with_token : git_url
|
197
|
+
end
|
198
|
+
|
199
|
+
def https_url_with_token
|
200
|
+
"https://#{token}@#{url}"
|
201
|
+
end
|
202
|
+
|
203
|
+
def git_url
|
204
|
+
"git@#{host}:#{slug}.git"
|
205
|
+
end
|
206
|
+
|
207
|
+
def url
|
208
|
+
"#{host}/#{slug}.git"
|
209
|
+
end
|
210
|
+
|
211
|
+
def slug
|
212
|
+
repo || repo_slug
|
213
|
+
end
|
214
|
+
|
215
|
+
def src_dir
|
216
|
+
@src_dir ||= expand(local_dir)
|
217
|
+
end
|
218
|
+
|
219
|
+
def work_dir
|
220
|
+
@work_dir ||= tmp_dir
|
221
|
+
end
|
222
|
+
|
223
|
+
def sufficient_scopes?
|
224
|
+
scopes.include?('public_repo') || scopes.include?('repo')
|
225
|
+
end
|
226
|
+
|
227
|
+
def user
|
228
|
+
@user ||= github.user
|
229
|
+
end
|
230
|
+
|
231
|
+
def user_name
|
232
|
+
user.name || user.login
|
233
|
+
end
|
234
|
+
|
235
|
+
def user_email
|
236
|
+
user.email
|
237
|
+
end
|
238
|
+
|
239
|
+
def scopes
|
240
|
+
@scopes ||= github.scopes
|
241
|
+
end
|
242
|
+
|
243
|
+
def pr_exists?
|
244
|
+
!!github.pulls(repo).detect { |pull| pull.head.ref == branch }
|
245
|
+
end
|
246
|
+
|
247
|
+
def create_pr
|
248
|
+
pr = github.create_pull_request(repo, base_branch, branch, "Update #{base_branch}")
|
249
|
+
info :pr_created, number: pr.number
|
250
|
+
end
|
251
|
+
|
252
|
+
def github?
|
253
|
+
host.include?('github') || enterprise?
|
254
|
+
end
|
255
|
+
|
256
|
+
def github
|
257
|
+
@github ||= Octokit::Client.new(access_token: token, api_endpoint: api_url, auto_paginate: true)
|
258
|
+
end
|
259
|
+
|
260
|
+
def api_url
|
261
|
+
enterprise? ? "https://#{host}/api/v3/" : 'https://api.github.com/'
|
262
|
+
end
|
263
|
+
|
264
|
+
def now
|
265
|
+
Time.now
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end
|
269
|
+
end
|
data/lib/dpl/providers/gleis.rb
CHANGED
data/lib/dpl/providers/lambda.rb
CHANGED
@@ -32,7 +32,7 @@ module Dpl
|
|
32
32
|
opt '--subnet_ids IDS', 'List of subnet IDs to be added to the function', type: :array, note: 'Needs the ec2:DescribeSubnets and ec2:DescribeVpcs permission for the user of the access/secret key to work'
|
33
33
|
opt '--security_group_ids IDS', 'List of security group IDs to be added to the function', type: :array, note: 'Needs the ec2:DescribeSecurityGroups and ec2:DescribeVpcs permission for the user of the access/secret key to work'
|
34
34
|
opt '--environment VARS', 'List of Environment Variables to add to the function', type: :array, format: /[\w\-]+=.+/, note: 'Can be encrypted for added security', alias: :environment_variables
|
35
|
-
opt '--runtime NAME', 'Lambda runtime to use', note: 'required when creating a new function', default: '
|
35
|
+
opt '--runtime NAME', 'Lambda runtime to use', note: 'required when creating a new function', default: 'nodejs10.x', enum: %w(nodejs16.x nodejs14.x nodejs12.x nodejs10.x python3.8 python3.7 python3.6 python2.7 ruby2.7 ruby2.5 java11 java8 go1.x dotnetcore2.1)
|
36
36
|
opt '--dead_letter_arn ARN', 'ARN to an SNS or SQS resource used for the dead letter queue.'
|
37
37
|
opt '--kms_key_arn ARN', 'KMS key ARN to use to encrypt environment_variables.'
|
38
38
|
opt '--tracing_mode MODE', 'Tracing mode', default: 'PassThrough', enum: %w(Active PassThrough), note: 'Needs xray:PutTraceSegments xray:PutTelemetryRecords on the role'
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Dpl
|
2
|
+
module Providers
|
3
|
+
class Nuget < Provider
|
4
|
+
status :alpha
|
5
|
+
|
6
|
+
full_name 'nuget'
|
7
|
+
|
8
|
+
description sq(<<-str)
|
9
|
+
tbd
|
10
|
+
str
|
11
|
+
|
12
|
+
env :nuget, :dotnet
|
13
|
+
|
14
|
+
opt '--api_key KEY', 'NuGet registry API key', required: true, secret: true, note: 'can be retrieved from your NuGet registry provider', see: 'https://docs.npmjs.com/creating-and-viewing-authentication-tokens'
|
15
|
+
opt '--registry URL', 'NuGet registry url', required: true, eg: 'https://www.myget.org/F/org-name/api/v2/package'
|
16
|
+
opt '--src SRC', 'The nupkg file(s) to publish', default: '*.nupkg'
|
17
|
+
opt '--no_symbols', 'Do not push symbols, even if present'
|
18
|
+
opt '--skip_duplicate', 'Do not overwrite existing packages'
|
19
|
+
|
20
|
+
msgs login: 'Authenticating with API key %{api_key}',
|
21
|
+
push: 'Pushing package %{src} to %{registry}'
|
22
|
+
|
23
|
+
cmds push: 'dotnet nuget push %{src} -k %{api_key} -s %{registry} %{push_opts}'
|
24
|
+
|
25
|
+
errs push: 'Failed to push'
|
26
|
+
|
27
|
+
def deploy
|
28
|
+
info :login
|
29
|
+
shell :push
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def push_opts
|
35
|
+
opts_for(%i(no_symbols skip_duplicate), dashed: true)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -58,7 +58,7 @@ module Dpl
|
|
58
58
|
cmds git_clone: 'git clone --quiet --branch="%{target_branch}" --depth=1 "%{remote_url}" . > /dev/null 2>&1',
|
59
59
|
git_init: 'git init .',
|
60
60
|
git_checkout: 'git checkout --orphan "%{target_branch}"',
|
61
|
-
check_deploy_key: 'ssh -i %{key} -T git
|
61
|
+
check_deploy_key: 'ssh -i %{key} -T git@%{url} 2>&1 | grep successful > /dev/null',
|
62
62
|
copy_files: 'rsync -rl --exclude .git --delete "%{src_dir}/" .',
|
63
63
|
git_config_email: 'git config user.email %{quoted_email}',
|
64
64
|
git_config_name: 'git config user.name %{quoted_name}',
|
@@ -68,7 +68,7 @@ module Dpl
|
|
68
68
|
git_commit_hook: 'cp %{path} .git/hooks/pre-commit',
|
69
69
|
git_commit: 'git commit %{git_commit_opts} -q %{git_commit_msg_opts}',
|
70
70
|
git_show: 'git show --stat-count=10 HEAD',
|
71
|
-
git_push: 'git push%{git_push_opts} --quiet "%{remote_url}" "%{target_branch}":"%{target_branch}"
|
71
|
+
git_push: 'git push%{git_push_opts} --quiet "%{remote_url}" "%{target_branch}":"%{target_branch}"'
|
72
72
|
|
73
73
|
errs copy_files: 'Failed to copy %{src_dir}.',
|
74
74
|
check_deploy_key: 'Failed to authenticate using the deploy key',
|
@@ -119,7 +119,7 @@ module Dpl
|
|
119
119
|
mv deploy_key, path
|
120
120
|
chmod 0600, path
|
121
121
|
setup_git_ssh path
|
122
|
-
shell :check_deploy_key, key: path
|
122
|
+
shell :check_deploy_key, key: path, url: opts[:url]
|
123
123
|
end
|
124
124
|
|
125
125
|
def git_clone?
|
@@ -155,7 +155,8 @@ module Dpl
|
|
155
155
|
end
|
156
156
|
|
157
157
|
def git_push
|
158
|
-
shell
|
158
|
+
shell 'ssh-keygen -lv -f /home/travis/.dpl/deploy_key'
|
159
|
+
shell :git_push
|
159
160
|
end
|
160
161
|
|
161
162
|
def git_status
|
@@ -11,8 +11,8 @@ module Dpl
|
|
11
11
|
tbd
|
12
12
|
str
|
13
13
|
|
14
|
-
gem 'puppet', '~>
|
15
|
-
gem 'puppet-blacksmith', '~>
|
14
|
+
gem 'puppet', '~> 6.26.0', require: 'puppet/face'
|
15
|
+
gem 'puppet-blacksmith', '~> 4.1.2', require: 'puppet_blacksmith'
|
16
16
|
|
17
17
|
env :puppetforge
|
18
18
|
|
@@ -31,7 +31,7 @@ module Dpl
|
|
31
31
|
opt '--file_glob', 'Interpret files as globs', default: true
|
32
32
|
opt '--overwrite', 'Overwrite files with the same name'
|
33
33
|
opt '--prerelease', 'Identify the release as a prerelease'
|
34
|
-
opt '--release_number NUM', 'Release number (
|
34
|
+
opt '--release_number NUM', 'Release number (override automatic release detection)'
|
35
35
|
opt '--release_notes STR', 'Content for the release notes', alias: :body
|
36
36
|
opt '--release_notes_file PATH', 'Path to a file containing the release notes', note: 'will be ignored if --release_notes is given'
|
37
37
|
opt '--draft', 'Identify the release as a draft'
|
@@ -70,13 +70,13 @@ module Dpl
|
|
70
70
|
|
71
71
|
def build
|
72
72
|
Dir[gemspec_glob].each do |gemspec|
|
73
|
-
shell :gem_build, gemspec: gemspec.
|
73
|
+
shell :gem_build, gemspec: gemspec.whitelist
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
77
|
def push
|
78
78
|
Dir["#{gem}-*.gem"].each do |file|
|
79
|
-
info :gem_push, gem: file.
|
79
|
+
info :gem_push, gem: file.whitelist
|
80
80
|
info Gems.push(File.new(file), *[host].compact)
|
81
81
|
end
|
82
82
|
end
|
data/lib/dpl/providers/snap.rb
CHANGED
data/lib/dpl/providers.rb
CHANGED
@@ -11,6 +11,7 @@ require 'dpl/providers/cloudfiles'
|
|
11
11
|
require 'dpl/providers/cloudformation'
|
12
12
|
require 'dpl/providers/cloudfoundry'
|
13
13
|
require 'dpl/providers/codedeploy'
|
14
|
+
require 'dpl/providers/ecr'
|
14
15
|
require 'dpl/providers/convox'
|
15
16
|
require 'dpl/providers/elasticbeanstalk'
|
16
17
|
require 'dpl/providers/engineyard'
|
@@ -18,6 +19,7 @@ require 'dpl/providers/firebase'
|
|
18
19
|
require 'dpl/providers/flynn'
|
19
20
|
require 'dpl/providers/gae'
|
20
21
|
require 'dpl/providers/gcs'
|
22
|
+
require 'dpl/providers/git_push'
|
21
23
|
require 'dpl/providers/gleis'
|
22
24
|
require 'dpl/providers/hackage'
|
23
25
|
require 'dpl/providers/hephy'
|
@@ -26,6 +28,7 @@ require 'dpl/providers/lambda'
|
|
26
28
|
require 'dpl/providers/launchpad'
|
27
29
|
require 'dpl/providers/netlify'
|
28
30
|
require 'dpl/providers/npm'
|
31
|
+
require 'dpl/providers/nuget'
|
29
32
|
require 'dpl/providers/openshift'
|
30
33
|
require 'dpl/providers/opsworks'
|
31
34
|
require 'dpl/providers/packagecloud'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class String
|
2
|
+
def whitelist
|
3
|
+
@is_whitelisted = true
|
4
|
+
|
5
|
+
self
|
6
|
+
end
|
7
|
+
|
8
|
+
def whitelisted?
|
9
|
+
@is_whitelisted
|
10
|
+
end
|
11
|
+
|
12
|
+
def blacklist
|
13
|
+
@is_whitelisted = false
|
14
|
+
|
15
|
+
self
|
16
|
+
end
|
17
|
+
|
18
|
+
def blacklisted?
|
19
|
+
@is_whitelisted.nil? ? false : !@is_whitelisted
|
20
|
+
end
|
21
|
+
end
|
data/lib/dpl/version.rb
CHANGED