dpl 1.8.16 → 1.8.17
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/README.md +1 -1
- data/dpl.gemspec +0 -1
- data/lib/dpl/provider/elastic_beanstalk.rb +38 -0
- data/lib/dpl/provider/gae.rb +0 -10
- data/lib/dpl/provider/s3.rb +16 -8
- data/lib/dpl/provider.rb +12 -0
- data/lib/dpl/version.rb +1 -1
- data/spec/provider/elastic_beanstalk_spec.rb +24 -4
- data/spec/provider/gae_spec.rb +1 -2
- data/spec/provider_spec.rb +13 -0
- data/spec/spec_helper.rb +0 -8
- metadata +2 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 72fde1a2ab1ae2bf50c0c5e2eb98c087c31395b4
|
|
4
|
+
data.tar.gz: 26f261efe42bdb31caeb5de0ac8e05fc951d87fd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 486de17ed6f9d995b239480460ee1612cf7a765b8a696621678c95b064baeacea8906765ab91c540a961533953f5d3ed6b803e3e6bae00152b2437de64f06145
|
|
7
|
+
data.tar.gz: 87acea2989c14e18d6f716c6e36a06e102eee5bf772c5543d3e61dd676b3b2eb32fbcdf890920e61a424a12aff6aa0d0eae812733f971a2175dcc6b42d8fa1c5
|
data/README.md
CHANGED
|
@@ -321,6 +321,7 @@ For authentication you can also use Travis CI secure environment variable:
|
|
|
321
321
|
* **acl**: Sets the access control for the uploaded objects. Defaults to `private`. Valid options are `private`, `public_read`, `public_read_write`, `authenticated_read`, `bucket_owner_read`, `bucket_owner_full_control`.
|
|
322
322
|
* **dot_match**: When set to `true`, upload files starting a `.`.
|
|
323
323
|
* **index_document_suffix**: Set the index document of a S3 website.
|
|
324
|
+
* **default_text_charset**: Set the default character set to append to the content-type of text files you are uploading.
|
|
324
325
|
|
|
325
326
|
#### File-specific `Cache-Control` and `Expires` headers
|
|
326
327
|
|
|
@@ -796,7 +797,6 @@ In order to use this provider, please make sure you have the [App Engine Admin A
|
|
|
796
797
|
* **version**: The version of the app that will be created or replaced by this deployment. If you do not specify a version, one will be generated for you. See [`gcloud preview app deploy`](https://cloud.google.com/sdk/gcloud/reference/preview/app/deploy)
|
|
797
798
|
* **no_promote**: Flag to not promote the deployed version. See [`gcloud preview app deploy`](https://cloud.google.com/sdk/gcloud/reference/preview/app/deploy)
|
|
798
799
|
* **verbosity**: Let's you adjust the verbosity when invoking `"gcloud"`. Defaults to `"warning"`. See [`gcloud`](https://cloud.google.com/sdk/gcloud/reference/).
|
|
799
|
-
* **docker_build**: If deploying a Managed VM, specifies where to build your image. Typical values are `"remote"` to build on Google Cloud Engine and `"local"` which requires Docker to be set up properly (to utilize this on Travis CI, read [Using Docker on Travis CI](http://blog.travis-ci.com/2015-08-19-using-docker-on-travis-ci/)). Defaults to `"remote"`.
|
|
800
800
|
* **no_stop_previous_version**: Flag to prevent your deployment from stopping the previously promoted version. This is from the future, so might not work (yet). See [`gcloud preview app deploy`](https://cloud.google.com/sdk/gcloud/reference/preview/app/deploy)
|
|
801
801
|
|
|
802
802
|
#### Environment variables:
|
data/dpl.gemspec
CHANGED
|
@@ -19,7 +19,6 @@ Gem::Specification.new do |s|
|
|
|
19
19
|
s.add_development_dependency 'rspec', '~> 3.0.0'
|
|
20
20
|
s.add_development_dependency 'rspec-its'
|
|
21
21
|
s.add_development_dependency 'rake'
|
|
22
|
-
s.add_development_dependency 'simplecov'
|
|
23
22
|
s.add_development_dependency 'json', '1.8.1'
|
|
24
23
|
s.add_development_dependency 'coveralls'
|
|
25
24
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'time'
|
|
2
|
+
|
|
1
3
|
module DPL
|
|
2
4
|
class Provider
|
|
3
5
|
class ElasticBeanstalk < Provider
|
|
@@ -32,6 +34,7 @@ module DPL
|
|
|
32
34
|
end
|
|
33
35
|
|
|
34
36
|
def push_app
|
|
37
|
+
@start_time = Time.now
|
|
35
38
|
create_bucket unless bucket_exists?
|
|
36
39
|
|
|
37
40
|
if options[:zip_file]
|
|
@@ -45,6 +48,7 @@ module DPL
|
|
|
45
48
|
version = create_app_version(s3_object)
|
|
46
49
|
if !only_create_app_version
|
|
47
50
|
update_app(version)
|
|
51
|
+
wait_until_deployed if options[:wait_until_deployed]
|
|
48
52
|
end
|
|
49
53
|
end
|
|
50
54
|
|
|
@@ -138,6 +142,40 @@ module DPL
|
|
|
138
142
|
eb.create_application_version(options)
|
|
139
143
|
end
|
|
140
144
|
|
|
145
|
+
# Wait until EB environment update finishes
|
|
146
|
+
def wait_until_deployed
|
|
147
|
+
errorEvents = 0 # errors counter, should remain 0 for successful deployment
|
|
148
|
+
events = []
|
|
149
|
+
|
|
150
|
+
loop do
|
|
151
|
+
environment = eb.describe_environments({
|
|
152
|
+
:application_name => app_name,
|
|
153
|
+
:environment_names => [env_name]
|
|
154
|
+
})[:environments].first
|
|
155
|
+
|
|
156
|
+
eb.describe_events({
|
|
157
|
+
:environment_name => env_name,
|
|
158
|
+
:start_time => @start_time.utc.iso8601,
|
|
159
|
+
})[:events].reverse.each do |event|
|
|
160
|
+
message = "#{event[:event_date]} [#{event[:severity]}] #{event[:message]}"
|
|
161
|
+
unless events.include?(message)
|
|
162
|
+
events.push(message)
|
|
163
|
+
if event[:severity] == "ERROR"
|
|
164
|
+
errorEvents += 1
|
|
165
|
+
warn(message)
|
|
166
|
+
else
|
|
167
|
+
log(message)
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
break if environment[:status] == "Ready"
|
|
173
|
+
sleep 5
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
if errorEvents > 0 then error("Deployment failed.") end
|
|
177
|
+
end
|
|
178
|
+
|
|
141
179
|
def update_app(version)
|
|
142
180
|
options = {
|
|
143
181
|
:environment_name => env_name,
|
data/lib/dpl/provider/gae.rb
CHANGED
|
@@ -58,31 +58,21 @@ module DPL
|
|
|
58
58
|
options[:no_promote]
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
-
def use_cloud_build
|
|
62
|
-
options[:use_cloud_build] || 'false'
|
|
63
|
-
end
|
|
64
|
-
|
|
65
61
|
def verbosity
|
|
66
62
|
options[:verbosity] || 'warning'
|
|
67
63
|
end
|
|
68
64
|
|
|
69
|
-
def docker_build
|
|
70
|
-
options[:docker_build] || 'remote'
|
|
71
|
-
end
|
|
72
|
-
|
|
73
65
|
def no_stop_previous_version
|
|
74
66
|
options[:no_stop_previous_version]
|
|
75
67
|
end
|
|
76
68
|
|
|
77
69
|
def push_app
|
|
78
|
-
context.shell "#{GCLOUD} config set app/use_cloud_build #{use_cloud_build}"
|
|
79
70
|
command = GCLOUD
|
|
80
71
|
command << ' --quiet'
|
|
81
72
|
command << " --verbosity \"#{verbosity}\""
|
|
82
73
|
command << " --project \"#{project}\""
|
|
83
74
|
command << " preview app deploy \"#{config}\""
|
|
84
75
|
command << " --version \"#{version}\""
|
|
85
|
-
command << " --docker-build \"#{docker_build}\""
|
|
86
76
|
command << " --#{no_promote ? 'no-' : ''}promote"
|
|
87
77
|
command << (no_stop_previous_version ? ' --no-stop-previous-version' : '')
|
|
88
78
|
unless context.shell(command)
|
data/lib/dpl/provider/s3.rb
CHANGED
|
@@ -46,13 +46,12 @@ module DPL
|
|
|
46
46
|
glob_args << File::FNM_DOTMATCH if options[:dot_match]
|
|
47
47
|
Dir.chdir(options.fetch(:local_dir, Dir.pwd)) do
|
|
48
48
|
Dir.glob(*glob_args) do |filename|
|
|
49
|
-
|
|
50
|
-
opts = { :content_type => content_type }.merge(encoding_option_for(filename))
|
|
49
|
+
opts = content_data_for(filename)
|
|
51
50
|
opts[:cache_control] = get_option_value_by_filename(options[:cache_control], filename) if options[:cache_control]
|
|
52
51
|
opts[:acl] = options[:acl].gsub(/_/, '-') if options[:acl]
|
|
53
52
|
opts[:expires] = get_option_value_by_filename(options[:expires], filename) if options[:expires]
|
|
54
53
|
unless File.directory?(filename)
|
|
55
|
-
log "uploading
|
|
54
|
+
log "uploading #{filename.inspect} with #{opts.inspect}"
|
|
56
55
|
api.bucket(option(:bucket)).object(upload_path(filename)).upload_file(filename, opts)
|
|
57
56
|
end
|
|
58
57
|
end
|
|
@@ -80,12 +79,21 @@ module DPL
|
|
|
80
79
|
end
|
|
81
80
|
|
|
82
81
|
private
|
|
83
|
-
def
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
def content_data_for(path)
|
|
83
|
+
content_data = {}
|
|
84
|
+
content_type = MIME::Types.type_for(path).first
|
|
85
|
+
content_data[:content_type] = content_type.to_s
|
|
86
|
+
|
|
87
|
+
encoding = encoding_for(path)
|
|
88
|
+
if detect_encoding?
|
|
89
|
+
content_data[:content_encoding] = encoding if encoding
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
if encoding == 'text' && default_text_charset?
|
|
93
|
+
content_data[:content_type] = "#{content_data[:content_type]}; charset=#{default_text_charset}"
|
|
88
94
|
end
|
|
95
|
+
|
|
96
|
+
return content_data
|
|
89
97
|
end
|
|
90
98
|
|
|
91
99
|
def get_option_value_by_filename(option_values, filename)
|
data/lib/dpl/provider.rb
CHANGED
|
@@ -212,6 +212,14 @@ module DPL
|
|
|
212
212
|
options[:detect_encoding]
|
|
213
213
|
end
|
|
214
214
|
|
|
215
|
+
def default_text_charset?
|
|
216
|
+
options[:default_text_charset]
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
def default_text_charset
|
|
220
|
+
options[:default_text_charset].downcase
|
|
221
|
+
end
|
|
222
|
+
|
|
215
223
|
def encoding_for(path)
|
|
216
224
|
file_cmd_output = `file '#{path}'`
|
|
217
225
|
case file_cmd_output
|
|
@@ -219,6 +227,10 @@ module DPL
|
|
|
219
227
|
'gzip'
|
|
220
228
|
when /compress'd/
|
|
221
229
|
'compress'
|
|
230
|
+
when /text/
|
|
231
|
+
'text'
|
|
232
|
+
when /data/
|
|
233
|
+
# Shrugs?
|
|
222
234
|
end
|
|
223
235
|
end
|
|
224
236
|
|
data/lib/dpl/version.rb
CHANGED
|
@@ -17,6 +17,7 @@ describe DPL::Provider::ElasticBeanstalk do
|
|
|
17
17
|
let(:bucket_name) { "travis-elasticbeanstalk-test-builds-#{region}" }
|
|
18
18
|
let(:bucket_path) { "some/app"}
|
|
19
19
|
let(:only_create_app_version) { nil }
|
|
20
|
+
let(:wait_until_deployed) { nil }
|
|
20
21
|
|
|
21
22
|
let(:bucket_mock) do
|
|
22
23
|
dbl = double("bucket mock", write: nil)
|
|
@@ -33,7 +34,8 @@ describe DPL::Provider::ElasticBeanstalk do
|
|
|
33
34
|
described_class.new(
|
|
34
35
|
DummyContext.new, :access_key_id => access_key_id, :secret_access_key => secret_access_key,
|
|
35
36
|
:region => region, :app => app, :env => env, :bucket_name => bucket_name, :bucket_path => bucket_path,
|
|
36
|
-
:only_create_app_version => only_create_app_version
|
|
37
|
+
:only_create_app_version => only_create_app_version,
|
|
38
|
+
:wait_until_deployed => wait_until_deployed
|
|
37
39
|
)
|
|
38
40
|
end
|
|
39
41
|
|
|
@@ -84,12 +86,12 @@ describe DPL::Provider::ElasticBeanstalk do
|
|
|
84
86
|
|
|
85
87
|
provider.push_app
|
|
86
88
|
end
|
|
87
|
-
|
|
89
|
+
|
|
88
90
|
context 'only creates app version' do
|
|
89
91
|
let(:only_create_app_version) { true }
|
|
90
|
-
|
|
92
|
+
|
|
91
93
|
example 'verify the app is not updated' do
|
|
92
|
-
|
|
94
|
+
|
|
93
95
|
expect(provider).to receive(:s3).and_return(s3_mock).twice
|
|
94
96
|
expect(provider).to receive(:create_bucket)
|
|
95
97
|
expect(provider).to receive(:create_zip).and_return('/path/to/file.zip')
|
|
@@ -121,5 +123,23 @@ describe DPL::Provider::ElasticBeanstalk do
|
|
|
121
123
|
provider_without_bucket_path.push_app
|
|
122
124
|
end
|
|
123
125
|
end
|
|
126
|
+
|
|
127
|
+
context 'When wait_until_deployed option is set' do
|
|
128
|
+
let(:wait_until_deployed) { true }
|
|
129
|
+
|
|
130
|
+
example 'Waits until deployment completes' do
|
|
131
|
+
expect(provider).to receive(:s3).and_return(s3_mock).twice
|
|
132
|
+
expect(provider).to receive(:create_bucket)
|
|
133
|
+
expect(provider).to receive(:create_zip).and_return('/path/to/file.zip')
|
|
134
|
+
expect(provider).to receive(:archive_name).and_return('file.zip')
|
|
135
|
+
expect(provider).to receive(:upload).with('file.zip', '/path/to/file.zip').and_call_original
|
|
136
|
+
expect(provider).to receive(:sleep).with(5)
|
|
137
|
+
expect(provider).to receive(:create_app_version).with(bucket_mock).and_return(app_version)
|
|
138
|
+
expect(provider).to receive(:update_app).with(app_version)
|
|
139
|
+
expect(provider).to receive(:wait_until_deployed)
|
|
140
|
+
|
|
141
|
+
provider.push_app
|
|
142
|
+
end
|
|
143
|
+
end
|
|
124
144
|
end
|
|
125
145
|
end
|
data/spec/provider/gae_spec.rb
CHANGED
|
@@ -8,8 +8,7 @@ describe DPL::Provider::GAE do
|
|
|
8
8
|
|
|
9
9
|
describe '#push_app' do
|
|
10
10
|
example 'with defaults' do
|
|
11
|
-
allow(provider.context).to receive(:shell).with("#{DPL::Provider::GAE::GCLOUD}
|
|
12
|
-
allow(provider.context).to receive(:shell).with("#{DPL::Provider::GAE::GCLOUD} --quiet --verbosity \"warning\" --project \"test\" preview app deploy \"app.yaml\" --version \"\" --docker-build \"remote\" --promote").and_return(true)
|
|
11
|
+
allow(provider.context).to receive(:shell).with("#{DPL::Provider::GAE::GCLOUD} --quiet --verbosity \"warning\" --project \"test\" preview app deploy \"app.yaml\" --version \"\" --promote").and_return(true)
|
|
13
12
|
provider.push_app
|
|
14
13
|
end
|
|
15
14
|
end
|
data/spec/provider_spec.rb
CHANGED
|
@@ -159,6 +159,19 @@ describe DPL::Provider do
|
|
|
159
159
|
expect(provider).to receive(:`).at_least(1).times.with("file '#{path}'").and_return("#{path}: empty")
|
|
160
160
|
expect(provider.encoding_for(path)).to be_nil
|
|
161
161
|
end
|
|
162
|
+
|
|
163
|
+
example do
|
|
164
|
+
path = 'foo.js'
|
|
165
|
+
expect(provider).to receive(:`).at_least(1).times.with("file '#{path}'").and_return("#{path}: ASCII text, with very long line")
|
|
166
|
+
expect(provider.encoding_for(path)).to eq('text')
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
example do
|
|
170
|
+
path = 'foo.js'
|
|
171
|
+
provider.options.update(:default_text_charset => 'UTF-8')
|
|
172
|
+
expect(provider).to receive(:`).at_least(1).times.with("file '#{path}'").and_return("#{path}: ASCII text, with very long line")
|
|
173
|
+
expect(provider.encoding_for(path)).to eq('text')
|
|
174
|
+
end
|
|
162
175
|
end
|
|
163
176
|
|
|
164
177
|
describe "#log" do
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
require 'simplecov'
|
|
2
1
|
require 'dpl/error'
|
|
3
2
|
require 'dpl/provider'
|
|
4
3
|
require 'rspec/its'
|
|
@@ -6,13 +5,6 @@ require 'coveralls'
|
|
|
6
5
|
|
|
7
6
|
Coveralls.wear!
|
|
8
7
|
|
|
9
|
-
SimpleCov.start do
|
|
10
|
-
coverage_dir '.coverage'
|
|
11
|
-
|
|
12
|
-
add_filter "/spec/"
|
|
13
|
-
add_group 'Library', 'lib'
|
|
14
|
-
end
|
|
15
|
-
|
|
16
8
|
class DummyContext
|
|
17
9
|
def shell(command)
|
|
18
10
|
end
|
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.8.
|
|
4
|
+
version: 1.8.17
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Konstantin Haase
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-06-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|
|
@@ -52,20 +52,6 @@ dependencies:
|
|
|
52
52
|
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0'
|
|
55
|
-
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: simplecov
|
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
|
58
|
-
requirements:
|
|
59
|
-
- - ">="
|
|
60
|
-
- !ruby/object:Gem::Version
|
|
61
|
-
version: '0'
|
|
62
|
-
type: :development
|
|
63
|
-
prerelease: false
|
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
-
requirements:
|
|
66
|
-
- - ">="
|
|
67
|
-
- !ruby/object:Gem::Version
|
|
68
|
-
version: '0'
|
|
69
55
|
- !ruby/object:Gem::Dependency
|
|
70
56
|
name: json
|
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|