eb_deployer 0.6.6 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -2
- data/Gemfile +1 -1
- data/bin/eb_deploy +3 -1
- data/eb_deployer.gemspec +3 -1
- data/lib/eb_deployer.rb +3 -3
- data/lib/eb_deployer/application.rb +2 -2
- data/lib/eb_deployer/config_loader.rb +1 -1
- data/lib/eb_deployer/deployment_strategy/blue_only.rb +0 -1
- data/lib/eb_deployer/eb_environment.rb +7 -2
- data/lib/eb_deployer/environment.rb +2 -1
- data/lib/eb_deployer/version.rb +1 -1
- data/lib/eb_deployer/version_cleaner.rb +1 -1
- data/lib/generators/eb_deployer/install/install_generator.rb +1 -1
- data/test/aws_driver_stubs.rb +9 -8
- data/test/eb_environment_test.rb +11 -0
- metadata +47 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 289171f2547c967c1eae9bc6d0f563dc21f22171
|
4
|
+
data.tar.gz: 45b726f54907a691b25bf9c7d988cef95033ad9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56223ac7b25c78454895e56da1c8d2ffbb1f472fcdf33410630a3ad5e7ca67c001c22974a5633a958ececaa114bca3972925e03b1c023749d7e2792c0795cfda
|
7
|
+
data.tar.gz: d4adf02b72603f9ce2ee50cd7fa48ad8736c3d659a4426bee6476a9053a0522cc5548f8f51838966a4c5b34d86fd093f84fd65296bb2ceed3bd12bb3fa74c3df
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,18 @@
|
|
1
|
+
0.7.0
|
2
|
+
=====
|
3
|
+
|
4
|
+
* Add service specific AWS sdk gems
|
5
|
+
* [#79](https://github.com/ThoughtWorksStudios/eb_deployer/pull/79): Environment updates can complete with errors
|
6
|
+
* [#82](https://github.com/ThoughtWorksStudios/eb_deployer/pull/82): Added a line to force STDOUT output every line
|
7
|
+
* [#85](https://github.com/ThoughtWorksStudios/eb_deployer/pull/85): Improve package not found error message
|
8
|
+
* [#86](https://github.com/ThoughtWorksStudios/eb_deployer/pull/86): Fix to for inactive stack updates when instances are 0
|
9
|
+
|
1
10
|
0.6.6
|
2
11
|
=====
|
3
12
|
|
4
|
-
* Add support for specifying (and overriding) a [stack policy](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/protect-stack-resources.html) for the CloudFormation resource stack
|
5
|
-
* Fix issue where deployment hangs if resource stack update fails and stack is rolled back, deployment will now fail when the resource stack update fails
|
13
|
+
* Add support for specifying (and overriding) a [stack policy](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/protect-stack-resources.html) for the CloudFormation resource stack. (contributed by @jlabrecque)
|
14
|
+
* Fix issue where deployment hangs if resource stack update fails and stack is rolled back, deployment will now fail when the resource stack update fails. (contributed by @jlabrecque)
|
15
|
+
* Add support for creating environment base on a elasticbeanstalk template. (contributed by @djpate)
|
6
16
|
|
7
17
|
0.6.5
|
8
18
|
=====
|
data/Gemfile
CHANGED
data/bin/eb_deploy
CHANGED
data/eb_deployer.gemspec
CHANGED
@@ -9,7 +9,9 @@ Gem::Specification.new do |gem|
|
|
9
9
|
gem.homepage = "https://github.com/ThoughtWorksStudios/eb_deployer"
|
10
10
|
gem.license = 'MIT'
|
11
11
|
|
12
|
-
gem.add_runtime_dependency 'aws-sdk',
|
12
|
+
gem.add_runtime_dependency 'aws-sdk-cloudformation', '~> 1.4', '>= 1.4.0'
|
13
|
+
gem.add_runtime_dependency 'aws-sdk-elasticbeanstalk', '~> 1.5', '~> 1.5.0'
|
14
|
+
gem.add_runtime_dependency 'aws-sdk-s3', '~> 1', '~> 1.0.0'
|
13
15
|
|
14
16
|
gem.files = `git ls-files`.split($\).reject {|f| f =~ /^samples\// }
|
15
17
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
data/lib/eb_deployer.rb
CHANGED
@@ -3,7 +3,9 @@ require 'set'
|
|
3
3
|
require 'time'
|
4
4
|
require 'json'
|
5
5
|
require 'timeout'
|
6
|
-
require 'aws-sdk'
|
6
|
+
require 'aws-sdk-s3'
|
7
|
+
require 'aws-sdk-elasticbeanstalk'
|
8
|
+
require 'aws-sdk-cloudformation'
|
7
9
|
require 'optparse'
|
8
10
|
require 'erb'
|
9
11
|
require 'fileutils'
|
@@ -242,7 +244,6 @@ module EbDeployer
|
|
242
244
|
app = opts[:application]
|
243
245
|
bs = opts[:bs_driver] || AWSDriver::Beanstalk.new
|
244
246
|
s3 = opts[:s3_driver] || AWSDriver::S3Driver.new
|
245
|
-
cf = opts[:cf_driver] || AWSDriver::CloudFormationDriver.new
|
246
247
|
|
247
248
|
Application.new(app, bs, s3).delete(opts[:environment])
|
248
249
|
end
|
@@ -316,7 +317,6 @@ module EbDeployer
|
|
316
317
|
|
317
318
|
opts.on("--debug", "Output AWS debug log") do |d|
|
318
319
|
require 'logger'
|
319
|
-
require 'aws-sdk'
|
320
320
|
logger = Logger.new($stdout)
|
321
321
|
logger.level = Logger::DEBUG
|
322
322
|
Aws.config.update(:logger => logger)
|
@@ -14,7 +14,7 @@ module EbDeployer
|
|
14
14
|
def create_version(version_label, package)
|
15
15
|
create_application_if_not_exists
|
16
16
|
|
17
|
-
source_bundle = if File.
|
17
|
+
source_bundle = if File.exist?(package)
|
18
18
|
if File.extname(package) == '.yml'
|
19
19
|
YAML.load(File.read(package))
|
20
20
|
else
|
@@ -26,7 +26,7 @@ module EbDeployer
|
|
26
26
|
bucket, obj_key = package.split(':')
|
27
27
|
{'s3_bucket' => bucket, 's3_key' => obj_key}
|
28
28
|
else
|
29
|
-
raise "
|
29
|
+
raise "Neither the file exists nor it is a valid s3 url: #{package.inspect}"
|
30
30
|
end
|
31
31
|
|
32
32
|
unless @eb_driver.application_version_labels(@name).include?(version_label)
|
@@ -17,6 +17,7 @@ module EbDeployer
|
|
17
17
|
@bs = eb_driver
|
18
18
|
@creation_opts = default_create_options.merge(reject_nil(creation_opts))
|
19
19
|
@accepted_healthy_states = @creation_opts[:accepted_healthy_states]
|
20
|
+
@event_poller = nil
|
20
21
|
end
|
21
22
|
|
22
23
|
def deploy(version_label, settings={})
|
@@ -35,7 +36,7 @@ module EbDeployer
|
|
35
36
|
def apply_settings(settings)
|
36
37
|
raise "Env #{self.name} not exists for applying settings" unless @bs.environment_exists?(@app, @name)
|
37
38
|
wait_for_env_status_to_be_ready
|
38
|
-
with_polling_events(/
|
39
|
+
with_polling_events(/Successfully deployed new configuration to environment/i) do
|
39
40
|
@bs.update_environment_settings(@app, @name, settings)
|
40
41
|
end
|
41
42
|
end
|
@@ -103,7 +104,7 @@ module EbDeployer
|
|
103
104
|
end
|
104
105
|
|
105
106
|
def update_eb_env(settings, version_label)
|
106
|
-
with_polling_events(/
|
107
|
+
with_polling_events(/Successfully deployed new configuration to environment/i) do
|
107
108
|
@bs.update_environment(@app,
|
108
109
|
@name,
|
109
110
|
version_label,
|
@@ -135,6 +136,10 @@ module EbDeployer
|
|
135
136
|
raise "Elasticbeanstalk instance provision failed (maybe a problem with your .ebextension files). The original message: #{event[:message]}"
|
136
137
|
end
|
137
138
|
|
139
|
+
if event[:message] =~ /complete, but with errors/
|
140
|
+
raise event[:message]
|
141
|
+
end
|
142
|
+
|
138
143
|
if event[:message] =~ /However, there were issues during launch\. See event log for details\./
|
139
144
|
raise "Environment launched, but with errors. The original message: #{event[:message]}"
|
140
145
|
end
|
@@ -3,7 +3,7 @@ module EbDeployer
|
|
3
3
|
include Utils
|
4
4
|
attr_accessor :creation_opts, :strategy_name
|
5
5
|
|
6
|
-
attr_writer :resource_stacks, :settings, :inactive_settings, :
|
6
|
+
attr_writer :resource_stacks, :settings, :inactive_settings, :component_under_deploy
|
7
7
|
|
8
8
|
attr_reader :name
|
9
9
|
|
@@ -16,6 +16,7 @@ module EbDeployer
|
|
16
16
|
@settings = []
|
17
17
|
@inactive_settings = []
|
18
18
|
@strategy_name = :blue_green
|
19
|
+
@components = nil
|
19
20
|
yield(self) if block_given?
|
20
21
|
unless @components
|
21
22
|
@components = [DefaultComponent.new(self, @creation_opts, @strategy_name, @eb_driver)]
|
data/lib/eb_deployer/version.rb
CHANGED
data/test/aws_driver_stubs.rb
CHANGED
@@ -8,6 +8,7 @@ class EBStub
|
|
8
8
|
@versions_deleted = {}
|
9
9
|
@event_fetched_times = 0
|
10
10
|
@envs_health_states = {}
|
11
|
+
@events = nil
|
11
12
|
end
|
12
13
|
|
13
14
|
def create_application(app)
|
@@ -25,7 +26,7 @@ class EBStub
|
|
25
26
|
end
|
26
27
|
|
27
28
|
def create_environment(app, env, solution_stack, cname_prefix, version, tier, tags, settings, template_name)
|
28
|
-
raise 'cname prefix is not avaible' if @envs.values.detect { |
|
29
|
+
raise 'cname prefix is not avaible' if @envs.values.detect { |value| value[:cname_prefix] == cname_prefix }
|
29
30
|
raise "env name #{env} is longer than 23 chars" if env.size > 23
|
30
31
|
raise "app not exists" unless application_exists?(app)
|
31
32
|
@envs[env_key(app, env)] = {
|
@@ -98,7 +99,7 @@ class EBStub
|
|
98
99
|
set_env_ready(app_name, env_name, true) # assume env become ready after it spit out all the events
|
99
100
|
|
100
101
|
unless @events # unrestricted mode for testing if no explicit events set
|
101
|
-
return [generate_event_from_messages(['
|
102
|
+
return [generate_event_from_messages(['Successfully deployed new configuration to environment',
|
102
103
|
'terminateEnvironment completed successfully',
|
103
104
|
'Successfully launched environment',
|
104
105
|
'Completed swapping CNAMEs for environments'
|
@@ -176,7 +177,7 @@ class EBStub
|
|
176
177
|
end
|
177
178
|
|
178
179
|
def list_solution_stack_names
|
179
|
-
|
180
|
+
["64bit Amazon Linux 2014.09 v1.1.0 running Tomcat 7 Java 7"]
|
180
181
|
end
|
181
182
|
|
182
183
|
#test only
|
@@ -207,7 +208,7 @@ class EBStub
|
|
207
208
|
|
208
209
|
def environment_names_for_application(app)
|
209
210
|
@envs.inject([]) do |memo, pair|
|
210
|
-
|
211
|
+
_, env = pair
|
211
212
|
memo << env[:name] if env[:application] == app
|
212
213
|
memo
|
213
214
|
end
|
@@ -340,10 +341,10 @@ class CFStub
|
|
340
341
|
|
341
342
|
def generate_event_from_messages(stack, messages)
|
342
343
|
messages.map do |message|
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
344
|
+
OpenStruct.new(timestamp: Time.now,
|
345
|
+
resource_type: 'AWS::CloudFormation::Stack',
|
346
|
+
logical_resource_id: stack,
|
347
|
+
resource_status: message)
|
347
348
|
end.reverse
|
348
349
|
end
|
349
350
|
end
|
data/test/eb_environment_test.rb
CHANGED
@@ -61,6 +61,17 @@ class EbEnvironmentTest < Test::Unit::TestCase
|
|
61
61
|
assert_raises(RuntimeError) { env.deploy("version 1") }
|
62
62
|
end
|
63
63
|
|
64
|
+
def test_should_raise_runtime_error_when_issues_during_environment_update
|
65
|
+
env = EbDeployer::EbEnvironment.new("myapp", "production", @eb_driver, :cname_prefix => 'myapp-production')
|
66
|
+
@eb_driver.set_events("myapp", t("production", 'myapp'),
|
67
|
+
[],
|
68
|
+
["start deploying",
|
69
|
+
"create environment",
|
70
|
+
"Update environment operation is complete, but with errors. For more information, see troubleshooting documentation."])
|
71
|
+
|
72
|
+
assert_raises(RuntimeError) { env.deploy("version 1") }
|
73
|
+
end
|
74
|
+
|
64
75
|
def test_should_raise_runtime_error_when_issues_during_launch
|
65
76
|
env = EbDeployer::EbEnvironment.new("myapp", "production", @eb_driver, :cname_prefix => 'myapp-production')
|
66
77
|
@eb_driver.set_events("myapp", t("production", 'myapp'),
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eb_deployer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- wpc
|
@@ -10,28 +10,68 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2018-04-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name: aws-sdk
|
16
|
+
name: aws-sdk-cloudformation
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
19
|
- - "~>"
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
21
|
+
version: '1.4'
|
22
22
|
- - ">="
|
23
23
|
- !ruby/object:Gem::Version
|
24
|
-
version:
|
24
|
+
version: 1.4.0
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
27
|
version_requirements: !ruby/object:Gem::Requirement
|
28
28
|
requirements:
|
29
29
|
- - "~>"
|
30
30
|
- !ruby/object:Gem::Version
|
31
|
-
version: '
|
31
|
+
version: '1.4'
|
32
32
|
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: 1.4.0
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: aws-sdk-elasticbeanstalk
|
37
|
+
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.5'
|
42
|
+
- - "~>"
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 1.5.0
|
45
|
+
type: :runtime
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - "~>"
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '1.5'
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.5.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: aws-sdk-s3
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1'
|
62
|
+
- - "~>"
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 1.0.0
|
65
|
+
type: :runtime
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '1'
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 1.0.0
|
35
75
|
description: For automating Blue-Green deployment flows on Elastic Beanstalk.
|
36
76
|
email:
|
37
77
|
- alex.hal9000@gmail.com
|
@@ -153,4 +193,3 @@ test_files:
|
|
153
193
|
- test/test_helper.rb
|
154
194
|
- test/tier_setting_deploy_test.rb
|
155
195
|
- test/versions_deploy_test.rb
|
156
|
-
has_rdoc:
|