dpl 1.7.7.travis.626.1 → 1.7.7.travis.633.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWM1Mzk0ZDQ0NTk3MGNjMjc2NWU3YjRkMjg0YTgyZWMxOTkyMjE0NA==
4
+ NDg4ZDExZTk2ZTM5Y2I1YzAyMjFhMWMzZjE2ODJlNDA4NjRkZTkwYQ==
5
5
  data.tar.gz: !binary |-
6
- NDk1YzAzOGEyOTNjMWFhMDNiNDIwNGEzZGJmNWNiMWZiZGU2MWQ1Zg==
6
+ ZGRlODM3NzM4Y2IzNTMxYTZkN2YwZGI2YmJhYWU5YjlhNWFlZmI2NA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OTU2NjVmN2RmYmRlZWQwZGVlYjk4M2Y5ZDNkNjVkNWEyZTY3MWRkOWViOWZl
10
- MmM3ZmM4YzgwMzcxYmY5ZWMxNzRhNTc2MjYzYTEyYjI4N2I2Yjg0YTI5ZmMw
11
- ODIxMTgxYzk5YTMzYjNkYjhhNThhMDUzMGUzZTExYTVlNzEyNzk=
9
+ YjRmZDE5MTAyMGE2MGMyMjY2ZDg3YmM1YTA2NjNjNzBmMmZlNGYxOTk5OGE1
10
+ OTYzZWVjYjIyOTExODMyNzE0MGU1Y2FjYjdjNzFiNWM1MGMyNmM5ZDQ2NTY0
11
+ ZWNkZThhYTJhMzgxZTRjNTBlMTU5Y2M1NzI5OGRjNTU2MjgzYmI=
12
12
  data.tar.gz: !binary |-
13
- YTczYjk0MTkwZDcwNDIxNWExOWM3ZmFjNTg4OGEwMmRmYzhmYmJjNTM2MWYz
14
- ODBlZWU1ZDFkYWYxZTIzMWNmZTA4NDY1YmNkN2E0NTVjMGZkZDk3NDFhNzBj
15
- NzFkYzRmMDNkMTgwMmJlNzcxYTg4Y2RkM2I2MDZmOTI1YzJiNWQ=
13
+ Y2I5NjYxMTAyYjk5OWI2YjYyN2JkYjJhZjVkZTY3OWI1YjMxNDliNzAxYWE4
14
+ MmViNjY4NjQ4NmM2ZjY4Y2ZlZTAxNGQ2YWRlYTlhYTY5MTIxYTQxMjEwNDhl
15
+ YzU1NGUxMjZlNDEyNGU4ODVhYjczNjkyMDNkNTE3YmQyNDFlOWU=
data/Gemfile CHANGED
@@ -21,10 +21,14 @@ group :rubygems do
21
21
  end
22
22
 
23
23
  group :sss do
24
- gem 'aws-sdk'
24
+ gem 'aws-sdk-v1'
25
25
  gem 'mime-types'
26
26
  end
27
27
 
28
+ group :code_deploy do
29
+ gem 'aws-sdk', '2.0.10.pre'
30
+ end
31
+
28
32
  group :cloud_files do
29
33
  gem 'fog'
30
34
  end
@@ -48,7 +52,7 @@ end
48
52
 
49
53
  group :elastic_beanstalk do
50
54
  gem 'rubyzip'
51
- gem 'aws-sdk'
55
+ gem 'aws-sdk-v1'
52
56
  end
53
57
 
54
58
  group :bitballoon do
@@ -3,7 +3,7 @@ require 'json'
3
3
  module DPL
4
4
  class Provider
5
5
  class CodeDeploy < Provider
6
- requires 'aws-sdk-core', pre: true
6
+ requires 'aws-sdk'
7
7
 
8
8
  def code_deploy
9
9
  @code_deploy ||= begin
@@ -3,7 +3,7 @@ module DPL
3
3
  class ElasticBeanstalk < Provider
4
4
  experimental 'AWS Elastic Beanstalk'
5
5
 
6
- requires 'aws-sdk'
6
+ requires 'aws-sdk-v1'
7
7
  requires 'rubyzip', :load => 'zip'
8
8
 
9
9
  DEFAULT_REGION = 'us-east-1'
@@ -3,7 +3,7 @@ require 'timeout'
3
3
  module DPL
4
4
  class Provider
5
5
  class OpsWorks < Provider
6
- requires 'aws-sdk'
6
+ requires 'aws-sdk-v1'
7
7
  experimental 'AWS OpsWorks'
8
8
 
9
9
  def api
@@ -3,7 +3,7 @@ require 'json'
3
3
  module DPL
4
4
  class Provider
5
5
  class S3 < Provider
6
- requires 'aws-sdk'
6
+ requires 'aws-sdk-v1'
7
7
  requires 'mime-types'
8
8
 
9
9
  def api
@@ -0,0 +1,342 @@
1
+ require 'spec_helper'
2
+ require 'aws-sdk'
3
+ require 'dpl/error'
4
+ require 'dpl/provider'
5
+ require 'dpl/provider/code_deploy'
6
+
7
+ describe DPL::Provider::CodeDeploy do
8
+
9
+ subject :provider do
10
+ described_class.new(DummyContext.new, :access_key_id => 'qwertyuiopasdfghjklz', :secret_access_key => 'qwertyuiopasdfghjklzqwertyuiopasdfghjklz')
11
+ end
12
+
13
+ describe '#code_deploy_options' do
14
+ context 'without region' do
15
+ example do
16
+ options = provider.code_deploy_options
17
+ expect(options[:region]).to eq('us-east-1')
18
+ end
19
+ end
20
+
21
+ context 'with region' do
22
+ example do
23
+ region = 'us-west-1'
24
+ provider.options.update(:region => region)
25
+ options = provider.code_deploy_options
26
+ expect(options[:region]).to eq(region)
27
+ end
28
+ end
29
+
30
+ context 'without endpoint' do
31
+ example do
32
+ options = provider.code_deploy_options
33
+ expect(options[:endpoint]).to eq(nil)
34
+ end
35
+ end
36
+
37
+ context 'with endpoint' do
38
+ example do
39
+ endpoint = 's3test.com.s3-website-us-west-2.amazonaws.com'
40
+ provider.options.update(:endpoint => endpoint)
41
+ options = provider.code_deploy_options
42
+ expect(options[:endpoint]).to eq(endpoint)
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ describe DPL::Provider::CodeDeploy do
49
+ access_key_id = 'someaccesskey'
50
+ secret_access_key = 'somesecretaccesskey'
51
+ application = 'app'
52
+ deployment_group = 'group'
53
+ description = 'description'
54
+ revision = '23jkljkl'
55
+ client_options = {
56
+ :stub_responses => true,
57
+ :region => 'us-east-1',
58
+ :credentials => Aws::Credentials.new(access_key_id, secret_access_key),
59
+ :endpoint => 'https://codedeploy.us-east-1.amazonaws.com'
60
+ }
61
+
62
+ subject :provider do
63
+ described_class.new(DummyContext.new, {
64
+ :access_key_id => access_key_id,
65
+ :secret_access_key => secret_access_key
66
+ })
67
+ end
68
+
69
+ before :each do
70
+ provider.stub(:code_deploy_options).and_return(client_options)
71
+ end
72
+
73
+ describe '#code_deploy' do
74
+ example do
75
+ expect(Aws::CodeDeploy::Client).to receive(:new).with(client_options).once
76
+ provider.code_deploy
77
+ end
78
+ end
79
+
80
+ describe '#needs_key?' do
81
+ example do
82
+ expect(provider.needs_key?).to eq(false)
83
+ end
84
+ end
85
+
86
+ describe '#revision' do
87
+ expected_s3_revision = {
88
+ revision_type: 'S3',
89
+ s3_location: {
90
+ bucket: 'bucket',
91
+ bundle_type: 'tar',
92
+ key: 'key'
93
+ }
94
+ }
95
+
96
+ expected_github_revision = {
97
+ revision_type: 'GitHub',
98
+ git_hub_location: {
99
+ commit_id: '2lk3j4k2j3k4j23k4j',
100
+ repository: 'travis-ci/dpl'
101
+ }
102
+ }
103
+
104
+ before(:each) do
105
+ provider.stub(:s3_revision).and_return(expected_s3_revision)
106
+ provider.stub(:github_revision).and_return(expected_github_revision)
107
+ end
108
+
109
+ context 'when s3' do
110
+ before do
111
+ provider.options.update(:revision_type => :s3)
112
+ end
113
+
114
+ example do
115
+ expect(provider.revision).to eq(expected_s3_revision)
116
+ end
117
+ end
118
+
119
+ context 'when github' do
120
+ before do
121
+ provider.options.update(:revision_type => :github)
122
+ end
123
+
124
+ example do
125
+ expect(provider.revision).to eq(expected_github_revision)
126
+ end
127
+ end
128
+
129
+ context 'when not specified' do
130
+ before do
131
+ provider.options.update(:bucket => 'bucket')
132
+ end
133
+
134
+ example do
135
+ expect(provider.revision).to eq(expected_s3_revision)
136
+ end
137
+ end
138
+
139
+ context 'when revision and bucket are not specified' do
140
+ example do
141
+ expect(provider.revision).to eq(expected_github_revision)
142
+ end
143
+ end
144
+
145
+ context 'when not a known revision type' do
146
+ type = :bad
147
+
148
+ before do
149
+ provider.options.update(:revision_type => type)
150
+ end
151
+
152
+ example do
153
+ expect(provider).to receive(:error).with(/unknown revision type :#{type}/)
154
+ provider.revision
155
+ end
156
+ end
157
+ end
158
+
159
+ describe '#s3_revision' do
160
+ bucket = 'bucket'
161
+ bundle_type = 'tar'
162
+ key = "/some/key.#{bundle_type}"
163
+
164
+ before(:each) do
165
+ expect(provider).to receive(:option).with(:bucket).and_return(bucket)
166
+ expect(provider).to receive(:bundle_type).and_return(bundle_type)
167
+ expect(provider).to receive(:s3_key).and_return(key)
168
+ end
169
+
170
+ example do
171
+ expect(provider.s3_revision).to eq({
172
+ revision_type: 'S3',
173
+ s3_location: {
174
+ bucket: bucket,
175
+ bundle_type: bundle_type,
176
+ key: key
177
+ }
178
+ })
179
+ end
180
+ end
181
+
182
+ describe '#github_revision' do
183
+ commit_id = '432s35s3'
184
+ repository = 'git@github.com/org/repo.git'
185
+
186
+ context 'with options set' do
187
+ before(:each) do
188
+ expect(provider.options).to receive(:[]).with(:commit_id).and_return(commit_id)
189
+ expect(provider.options).to receive(:[]).with(:repository).and_return(repository)
190
+ end
191
+
192
+ example do
193
+ expect(provider.github_revision).to eq({
194
+ revision_type: 'GitHub',
195
+ git_hub_location: {
196
+ commit_id: commit_id,
197
+ repository: repository
198
+ }
199
+ })
200
+ end
201
+ end
202
+
203
+ context 'with environment variables' do
204
+ before(:each) do
205
+ expect(provider.options).to receive(:[]).with(:commit_id).and_return(nil)
206
+ expect(provider.options).to receive(:[]).with(:repository).and_return(nil)
207
+ expect(provider.context.env).to receive(:[]).with('TRAVIS_COMMIT').and_return(commit_id)
208
+ expect(provider.context.env).to receive(:[]).with('TRAVIS_REPO_SLUG').and_return(repository)
209
+ end
210
+
211
+ example do
212
+ expect(provider.github_revision).to eq({
213
+ revision_type: 'GitHub',
214
+ git_hub_location: {
215
+ commit_id: commit_id,
216
+ repository: repository
217
+ }
218
+ })
219
+ end
220
+ end
221
+
222
+ context 'without required options' do
223
+ before(:each) do
224
+ expect(provider.options).to receive(:[]).with(:commit_id).and_return(nil)
225
+ provider.options.stub(:[]).with(:repository) { nil }
226
+ expect(provider.context.env).to receive(:[]).with('TRAVIS_COMMIT').and_return(nil)
227
+ expect(provider.context.env).to receive(:[]).with('TRAVIS_REPO_SLUG').and_return(nil)
228
+ end
229
+
230
+ example do
231
+ expect{provider.github_revision}.to raise_error(DPL::Error)
232
+ end
233
+ end
234
+ end
235
+
236
+ describe '#push_app' do
237
+ before(:each) do
238
+ old_options = provider.options
239
+ provider.stub(:options) {old_options.merge({
240
+ :application_name => application,
241
+ :deployment_group_name => deployment_group,
242
+ :description => description,
243
+ :repository => 'git@github.com:travis-ci/dpl.git'
244
+ })}
245
+ end
246
+
247
+ context 'without an error' do
248
+ deployment_id = 'some-deployment-id'
249
+
250
+ before do
251
+ provider.code_deploy.stub_responses(:create_deployment, :deployment_id => deployment_id)
252
+ end
253
+
254
+ example do
255
+ expect(provider).to receive(:log).with(/Triggered deployment \"#{deployment_id}\"\./)
256
+ provider.push_app
257
+ end
258
+ end
259
+
260
+ context 'with an error' do
261
+ before do
262
+ provider.code_deploy.stub_responses(:create_deployment, 'DeploymentLimitExceededException')
263
+ end
264
+
265
+ example do
266
+ expect(provider).to receive(:error).once
267
+ provider.push_app
268
+ end
269
+ end
270
+ end
271
+
272
+ describe '#bundle_type' do
273
+ context 'with s3_key' do
274
+ format = 'zip'
275
+ s3_key = "/some/key/name.#{format}"
276
+
277
+ before(:each) do
278
+ expect(provider).to receive(:s3_key).and_return(s3_key)
279
+ end
280
+
281
+ example do
282
+ expect(provider.bundle_type).to eq(format)
283
+ end
284
+ end
285
+
286
+ context 'without s3_key' do
287
+ bundle_type = 'tar'
288
+
289
+ before do
290
+ expect(provider).to receive(:s3_key).and_return('')
291
+ expect(provider).to receive(:option).with(:bundle_type).and_return(bundle_type)
292
+ end
293
+
294
+ example do
295
+ expect(provider.bundle_type).to eq(bundle_type)
296
+ end
297
+ end
298
+ end
299
+
300
+ describe '#s3_key' do
301
+ key = '/some/key/name.zip'
302
+
303
+ context 'with key option' do
304
+ before do
305
+ expect(provider.options).to receive(:[]).with(:key).and_return(key)
306
+ end
307
+
308
+ example do
309
+ expect(provider.s3_key).to eq(key)
310
+ end
311
+ end
312
+
313
+ context 'with s3_key option' do
314
+ before do
315
+ expect(provider).to receive(:option).with(:s3_key).and_return(key)
316
+ end
317
+
318
+ example do
319
+ expect(provider.s3_key).to eq(key)
320
+ end
321
+ end
322
+ end
323
+
324
+ describe '#default_description' do
325
+ build_number = 2
326
+
327
+ before do
328
+ provider.context.env.stub(:[]).with('TRAVIS_BUILD_NUMBER').and_return(build_number)
329
+ end
330
+
331
+ example do
332
+ expect(provider.default_description).to eq("Deploy build #{build_number} via Travis CI")
333
+ end
334
+ end
335
+
336
+ describe '#check_auth' do
337
+ example do
338
+ expect(provider).to receive(:log).with("Logging in with Access Key: #{access_key_id[-4..-1].rjust(20, '*')}")
339
+ provider.check_auth
340
+ end
341
+ end
342
+ end
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- require 'aws-sdk'
2
+ require 'aws-sdk-v1'
3
3
  require 'dpl/provider'
4
4
  require 'dpl/provider/elastic_beanstalk'
5
5
 
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- require 'aws-sdk'
2
+ require 'aws-sdk-v1'
3
3
  require 'dpl/provider'
4
4
  require 'dpl/provider/ops_works'
5
5
 
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- require 'aws-sdk'
2
+ require 'aws-sdk-v1'
3
3
  require 'dpl/provider/s3'
4
4
 
5
5
  describe DPL::Provider::S3 do
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.7.7.travis.626.1
4
+ version: 1.7.7.travis.633.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-18 00:00:00.000000000 Z
11
+ date: 2014-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -145,6 +145,7 @@ files:
145
145
  - spec/provider/cloud_files_spec.rb
146
146
  - spec/provider/cloudcontrol_spec.rb
147
147
  - spec/provider/cloudfoundry_spec.rb
148
+ - spec/provider/code_deploy_spec.rb
148
149
  - spec/provider/deis_spec.rb
149
150
  - spec/provider/divshot_spec.rb
150
151
  - spec/provider/dotcloud_spec.rb