eb_deployer 0.3.7 → 0.3.8
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 +7 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +1 -1
- data/lib/eb_deployer/eb_environment.rb +20 -9
- data/lib/eb_deployer/version.rb +1 -1
- data/test/deploy_test.rb +42 -34
- data/test/eb_environment_test.rb +5 -5
- data/test/test_helper.rb +0 -5
- metadata +20 -31
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: adfb84fcb5cfc542a7dbd3634358739b9db48283
|
4
|
+
data.tar.gz: 46dd232647393e435ff65b2cab8ecdfe82de6f54
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d3cc4a4ec8d89f9046ec54d22f95b0d65585b7c3404c2904cd4473180ea945ca868ecef15acc9c57c9b58ef79bfee2d26d8831be8aa08d564188721a59175691
|
7
|
+
data.tar.gz: 0870b0bc37619d8f65837b10820a3ac9cfd64ab84f601f052402a12a4467687f544a624d34996ccedd4c2a5fa399c040ffccbcd44bf765d6392b472e94886e97
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,4 @@
|
|
1
|
+
0.3.8
|
2
|
+
=====
|
3
|
+
* Change ElasticBeanstalk environment name pattern. Stop using sufix hash to make eb environment global unique. (Because ElasticBeanstalk does not require environment has globally uniqe name any more.)
|
4
|
+
* Add migration logic so that if a ElasticBeanstalk environment with legcy name exists, eb_deployer will automaticly terminate it and replace it with ElasticBeanstalk environment has new name pattern.
|
data/Gemfile
CHANGED
@@ -3,20 +3,20 @@ module EbDeployer
|
|
3
3
|
attr_reader :app, :name
|
4
4
|
attr_writer :event_poller
|
5
5
|
|
6
|
-
def self.
|
7
|
-
raise "Environment name #{env_name} is too long, it must be under 15 chars" if env_name.size > 15
|
6
|
+
def self.legacy_ebenv_name(app_name, env_name)
|
8
7
|
digest = Digest::SHA1.hexdigest(app_name + '-' + env_name)[0..6]
|
9
8
|
"#{env_name}-#{digest}"
|
10
9
|
end
|
11
10
|
|
12
|
-
def initialize(app,
|
11
|
+
def initialize(app, name, eb_driver, creation_opts={})
|
13
12
|
@app = app
|
14
|
-
@name =
|
13
|
+
@name = name
|
15
14
|
@bs = eb_driver
|
16
15
|
@creation_opts = creation_opts
|
17
16
|
end
|
18
17
|
|
19
18
|
def deploy(version_label, settings={})
|
19
|
+
terminate_legacy_env
|
20
20
|
terminate if @creation_opts[:phoenix_mode]
|
21
21
|
create_or_update_env(version_label, settings)
|
22
22
|
smoke_test
|
@@ -41,16 +41,27 @@ module EbDeployer
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def terminate
|
44
|
-
|
44
|
+
terminate_environment(@name)
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def terminate_legacy_env
|
50
|
+
legacy_env_name = self.class.legacy_ebenv_name(@app, @name)
|
51
|
+
if @bs.environment_exists?(@app, legacy_env_name)
|
52
|
+
log("Found legacy environment '#{legacy_env_name}', eb_deployer will terminate it and create new environment following new name pattern.")
|
53
|
+
terminate_environment(legacy_env_name)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def terminate_environment(env_name)
|
58
|
+
if @bs.environment_exists?(@app, env_name)
|
45
59
|
with_polling_events(/terminateEnvironment completed successfully/i) do
|
46
|
-
@bs.delete_environment(@app,
|
60
|
+
@bs.delete_environment(@app, env_name)
|
47
61
|
end
|
48
62
|
end
|
49
63
|
end
|
50
64
|
|
51
|
-
|
52
|
-
private
|
53
|
-
|
54
65
|
def create_or_update_env(version_label, settings)
|
55
66
|
if @bs.environment_exists?(@app, @name)
|
56
67
|
with_polling_events(/Environment update completed successfully/i) do
|
data/lib/eb_deployer/version.rb
CHANGED
data/test/deploy_test.rb
CHANGED
@@ -36,7 +36,7 @@ class DeployTest < MiniTest::Unit::TestCase
|
|
36
36
|
deploy(:application => 'simple', :environment => "production",
|
37
37
|
:option_settings => [redudant])
|
38
38
|
|
39
|
-
assert_equal [redudant], @eb_driver.environment_settings('simple',
|
39
|
+
assert_equal [redudant], @eb_driver.environment_settings('simple', 'production')
|
40
40
|
|
41
41
|
end
|
42
42
|
|
@@ -44,35 +44,35 @@ class DeployTest < MiniTest::Unit::TestCase
|
|
44
44
|
deploy(:application => 'simple', :environment => "production")
|
45
45
|
destroy(:application => 'simple')
|
46
46
|
assert !@eb_driver.application_exists?('simple')
|
47
|
-
assert !@eb_driver.environment_exists?('simple',
|
47
|
+
assert !@eb_driver.environment_exists?('simple', 'production')
|
48
48
|
end
|
49
49
|
|
50
50
|
def test_first_deployment_create_environment
|
51
|
-
assert !@eb_driver.environment_exists?('simple',
|
51
|
+
assert !@eb_driver.environment_exists?('simple', 'production')
|
52
52
|
deploy(:application => 'simple', :environment => "production")
|
53
|
-
assert @eb_driver.environment_exists?('simple',
|
53
|
+
assert @eb_driver.environment_exists?('simple', 'production')
|
54
54
|
end
|
55
55
|
|
56
56
|
def test_support_very_very_long_app_name
|
57
57
|
deploy(:application => 'ver-very-simple-application', :environment => "production")
|
58
|
-
assert @eb_driver.environment_exists?('ver-very-simple-application',
|
58
|
+
assert @eb_driver.environment_exists?('ver-very-simple-application', 'production')
|
59
59
|
end
|
60
60
|
|
61
61
|
def test_should_raise_error_when_env_name_is_too_long
|
62
|
-
assert_raises(RuntimeError) { deploy(:application => 'simple', :environment => "p" *
|
62
|
+
assert_raises(RuntimeError) { deploy(:application => 'simple', :environment => "p" * 24) }
|
63
63
|
end
|
64
64
|
|
65
65
|
def test_update_environment_with_new_version_should_change_version_that_deployed
|
66
66
|
deploy(:application => 'simple',
|
67
67
|
:environment => "production",
|
68
68
|
:version_label => 1)
|
69
|
-
assert_equal '1', @eb_driver.environment_verion_label('simple',
|
69
|
+
assert_equal '1', @eb_driver.environment_verion_label('simple', 'production')
|
70
70
|
|
71
71
|
deploy(:application => 'simple',
|
72
72
|
:environment => "production",
|
73
73
|
:version_label => 2)
|
74
74
|
|
75
|
-
assert_equal '2', @eb_driver.environment_verion_label('simple',
|
75
|
+
assert_equal '2', @eb_driver.environment_verion_label('simple', 'production')
|
76
76
|
end
|
77
77
|
|
78
78
|
def test_version_prefix_should_be_prepended_to_version_label
|
@@ -80,7 +80,7 @@ class DeployTest < MiniTest::Unit::TestCase
|
|
80
80
|
:environment => "production",
|
81
81
|
:version_label => 1,
|
82
82
|
:version_prefix => "prod-")
|
83
|
-
assert_equal 'prod-1', @eb_driver.environment_verion_label('simple',
|
83
|
+
assert_equal 'prod-1', @eb_driver.environment_verion_label('simple', 'production')
|
84
84
|
end
|
85
85
|
|
86
86
|
def test_should_keep_only_number_of_versions_specified
|
@@ -128,7 +128,7 @@ class DeployTest < MiniTest::Unit::TestCase
|
|
128
128
|
deploy(:application => 'simple',
|
129
129
|
:environment => "production",
|
130
130
|
:version_label => 42)
|
131
|
-
assert_equal "simple-production", @eb_driver.environment_cname_prefix('simple',
|
131
|
+
assert_equal "simple-production", @eb_driver.environment_cname_prefix('simple', 'production')
|
132
132
|
end
|
133
133
|
|
134
134
|
def test_cname_prefix_can_be_override
|
@@ -136,7 +136,7 @@ class DeployTest < MiniTest::Unit::TestCase
|
|
136
136
|
:environment => "production",
|
137
137
|
:cname_prefix => 'sports123',
|
138
138
|
:version_label => 42)
|
139
|
-
assert_equal "sports123", @eb_driver.environment_cname_prefix('simple',
|
139
|
+
assert_equal "sports123", @eb_driver.environment_cname_prefix('simple', 'production')
|
140
140
|
end
|
141
141
|
|
142
142
|
def test_smoke_test_should_be_run_after_env_created_or_update
|
@@ -164,8 +164,8 @@ class DeployTest < MiniTest::Unit::TestCase
|
|
164
164
|
:strategy => 'blue-green',
|
165
165
|
:version_label => 42)
|
166
166
|
|
167
|
-
assert @eb_driver.environment_exists?('simple',
|
168
|
-
assert_equal 'simple-production', @eb_driver.environment_cname_prefix('simple',
|
167
|
+
assert @eb_driver.environment_exists?('simple', 'production-a')
|
168
|
+
assert_equal 'simple-production', @eb_driver.environment_cname_prefix('simple', 'production-a')
|
169
169
|
end
|
170
170
|
|
171
171
|
|
@@ -180,8 +180,8 @@ class DeployTest < MiniTest::Unit::TestCase
|
|
180
180
|
:strategy => 'blue-green',
|
181
181
|
:version_label => 43)
|
182
182
|
|
183
|
-
assert @eb_driver.environment_exists?('simple',
|
184
|
-
assert @eb_driver.environment_exists?('simple',
|
183
|
+
assert @eb_driver.environment_exists?('simple', 'production-a')
|
184
|
+
assert @eb_driver.environment_exists?('simple', 'production-b')
|
185
185
|
end
|
186
186
|
|
187
187
|
|
@@ -196,9 +196,9 @@ class DeployTest < MiniTest::Unit::TestCase
|
|
196
196
|
:strategy => 'blue-green',
|
197
197
|
:version_label => 43)
|
198
198
|
|
199
|
-
assert_match(/simple-production-inactive/, @eb_driver.environment_cname_prefix('simple',
|
199
|
+
assert_match(/simple-production-inactive/, @eb_driver.environment_cname_prefix('simple', 'production-a'))
|
200
200
|
|
201
|
-
assert_equal 'simple-production', @eb_driver.environment_cname_prefix('simple',
|
201
|
+
assert_equal 'simple-production', @eb_driver.environment_cname_prefix('simple', 'production-b')
|
202
202
|
|
203
203
|
|
204
204
|
deploy(:application => 'simple',
|
@@ -206,9 +206,9 @@ class DeployTest < MiniTest::Unit::TestCase
|
|
206
206
|
:strategy => 'blue-green',
|
207
207
|
:version_label => 44)
|
208
208
|
|
209
|
-
assert_match(/simple-production-inactive/, @eb_driver.environment_cname_prefix('simple',
|
209
|
+
assert_match(/simple-production-inactive/, @eb_driver.environment_cname_prefix('simple', 'production-b'))
|
210
210
|
|
211
|
-
assert_equal 'simple-production', @eb_driver.environment_cname_prefix('simple',
|
211
|
+
assert_equal 'simple-production', @eb_driver.environment_cname_prefix('simple', 'production-a')
|
212
212
|
end
|
213
213
|
|
214
214
|
|
@@ -300,7 +300,7 @@ class DeployTest < MiniTest::Unit::TestCase
|
|
300
300
|
}
|
301
301
|
})
|
302
302
|
|
303
|
-
assert @eb_driver.environment_settings('simple',
|
303
|
+
assert @eb_driver.environment_settings('simple', 'production').
|
304
304
|
include?({:namespace => 'aws.foo', :option_name => 'o2', :value => 'transformed value of O2'})
|
305
305
|
end
|
306
306
|
|
@@ -325,7 +325,7 @@ class DeployTest < MiniTest::Unit::TestCase
|
|
325
325
|
'O1' => lambda { |v| {:namespace => 'aws.foo', :option_name => 'o1', :value => v} }
|
326
326
|
}
|
327
327
|
})
|
328
|
-
assert @eb_driver.environment_settings('simple',
|
328
|
+
assert @eb_driver.environment_settings('simple', 'production').
|
329
329
|
include?({:namespace => 'aws.foo', :option_name => 'o1', :value => 'value of O1'})
|
330
330
|
end
|
331
331
|
|
@@ -356,10 +356,10 @@ class DeployTest < MiniTest::Unit::TestCase
|
|
356
356
|
|
357
357
|
def test_should_terminate_old_environment_if_phoenix_mode_is_enabled
|
358
358
|
deploy(:application => 'simple', :environment => "production", :phoenix_mode => true)
|
359
|
-
assert @eb_driver.environment_exists?('simple',
|
359
|
+
assert @eb_driver.environment_exists?('simple', 'production')
|
360
360
|
deploy(:application => 'simple', :environment => "production", :phoenix_mode => true)
|
361
|
-
assert @eb_driver.environments_been_deleted('simple').include?(
|
362
|
-
assert @eb_driver.environment_exists?('simple',
|
361
|
+
assert @eb_driver.environments_been_deleted('simple').include?('production')
|
362
|
+
assert @eb_driver.environment_exists?('simple', 'production')
|
363
363
|
end
|
364
364
|
|
365
365
|
def test_blue_green_deployment_should_delete_and_recreate_inactive_env_if_phoenix_mode_is_enabled
|
@@ -377,7 +377,7 @@ class DeployTest < MiniTest::Unit::TestCase
|
|
377
377
|
|
378
378
|
assert_equal [], @eb_driver.environments_been_deleted('simple')
|
379
379
|
|
380
|
-
inactive_env =
|
380
|
+
inactive_env = 'production-a'
|
381
381
|
assert_match(/inactive/, @eb_driver.environment_cname_prefix('simple', inactive_env))
|
382
382
|
|
383
383
|
|
@@ -405,12 +405,12 @@ class DeployTest < MiniTest::Unit::TestCase
|
|
405
405
|
|
406
406
|
def test_sets_default_tier_as_webserver
|
407
407
|
deploy(:application => 'simple', :environment => "production")
|
408
|
-
assert_equal EbDeployer.environment_tier('WebServer'), @eb_driver.environment_tier('simple',
|
408
|
+
assert_equal EbDeployer.environment_tier('WebServer'), @eb_driver.environment_tier('simple', 'production')
|
409
409
|
end
|
410
410
|
|
411
411
|
def test_can_change_tier
|
412
412
|
deploy(:application => 'simple', :environment => "production", :tier => 'Worker')
|
413
|
-
assert_equal EbDeployer.environment_tier('Worker'), @eb_driver.environment_tier('simple',
|
413
|
+
assert_equal EbDeployer.environment_tier('Worker'), @eb_driver.environment_tier('simple', 'production')
|
414
414
|
end
|
415
415
|
|
416
416
|
def test_should_raise_error_when_tier_setting_is_not_recognized
|
@@ -432,16 +432,24 @@ class DeployTest < MiniTest::Unit::TestCase
|
|
432
432
|
assert_equal({'s3_bucket' => 'test-bucket', 's3_key' => 'test-mingle.war'}, last_version[:source_bundle])
|
433
433
|
end
|
434
434
|
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
:components => [{ :name => 'web' }])
|
435
|
+
# def test_deploy_with_components
|
436
|
+
# deploy(:application => 'simple',
|
437
|
+
# :environment => 'production',
|
438
|
+
# :components => [{ :name => 'web' }])
|
440
439
|
|
441
|
-
|
440
|
+
# assert @eb_driver.environment_exists?('simple', 'production-web')
|
441
|
+
# end
|
442
442
|
|
443
|
+
def test_should_clean_up_legacy_environment_on_deploy
|
444
|
+
legacy_env_name = EbDeployer::EbEnvironment.legacy_ebenv_name("simple", "production")
|
445
|
+
@eb_driver.create_application("simple")
|
446
|
+
@eb_driver.create_environment("simple", legacy_env_name, 'solution-stack', 'simple-production', 'foo', 'web' ,{})
|
447
|
+
deploy(:application => 'simple',
|
448
|
+
:environment => 'production',
|
449
|
+
:version_label => 1)
|
450
|
+
assert @eb_driver.environment_exists?("simple", "production")
|
451
|
+
assert !@eb_driver.environment_exists?("simple", legacy_env_name)
|
443
452
|
end
|
444
|
-
=end
|
445
453
|
|
446
454
|
private
|
447
455
|
|
data/test/eb_environment_test.rb
CHANGED
@@ -27,21 +27,21 @@ class EbEnvironmentTest < MiniTest::Unit::TestCase
|
|
27
27
|
def test_deploy_should_create_corresponding_eb_env
|
28
28
|
env = EbDeployer::EbEnvironment.new("myapp", "production", @eb_driver)
|
29
29
|
env.deploy("version1")
|
30
|
-
assert @eb_driver.environment_exists?('myapp',
|
30
|
+
assert @eb_driver.environment_exists?('myapp', 'production')
|
31
31
|
end
|
32
32
|
|
33
33
|
def test_deploy_again_should_update_environment
|
34
34
|
env = EbDeployer::EbEnvironment.new("myapp", "production", @eb_driver)
|
35
35
|
env.deploy("version1")
|
36
36
|
env.deploy("version2")
|
37
|
-
assert @eb_driver.environment_exists?('myapp',
|
38
|
-
assert_equal 'version2', @eb_driver.environment_verion_label('myapp',
|
37
|
+
assert @eb_driver.environment_exists?('myapp', 'production')
|
38
|
+
assert_equal 'version2', @eb_driver.environment_verion_label('myapp', 'production')
|
39
39
|
end
|
40
40
|
|
41
41
|
def test_option_setttings_get_set_on_eb_env
|
42
42
|
env = EbDeployer::EbEnvironment.new("myapp", "production", @eb_driver)
|
43
43
|
env.deploy("version1", {s1: 'v1'})
|
44
|
-
assert_equal({s1: 'v1' }, @eb_driver.environment_settings('myapp',
|
44
|
+
assert_equal({s1: 'v1' }, @eb_driver.environment_settings('myapp', 'production'))
|
45
45
|
end
|
46
46
|
|
47
47
|
def test_should_run_smoke_test_after_deploy
|
@@ -75,7 +75,7 @@ class EbEnvironmentTest < MiniTest::Unit::TestCase
|
|
75
75
|
env = EbDeployer::EbEnvironment.new("myapp", "production", @eb_driver)
|
76
76
|
env.deploy("version1")
|
77
77
|
env.terminate
|
78
|
-
assert !@eb_driver.environment_exists?('myapp',
|
78
|
+
assert !@eb_driver.environment_exists?('myapp', 'production')
|
79
79
|
end
|
80
80
|
|
81
81
|
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,33 +1,30 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eb_deployer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.8
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- wpc
|
9
8
|
- betarelease
|
10
|
-
autorequire:
|
9
|
+
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2014-03-
|
12
|
+
date: 2014-03-27 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: aws-sdk
|
17
|
-
|
18
|
-
none: false
|
16
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - '>='
|
21
19
|
- !ruby/object:Gem::Version
|
22
20
|
version: '0'
|
23
|
-
|
24
|
-
prerelease: false
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
21
|
+
requirement: !ruby/object:Gem::Requirement
|
27
22
|
requirements:
|
28
|
-
- -
|
23
|
+
- - '>='
|
29
24
|
- !ruby/object:Gem::Version
|
30
25
|
version: '0'
|
26
|
+
prerelease: false
|
27
|
+
type: :runtime
|
31
28
|
description: For automating Blue-Green deployment flows on Elastic Beanstalk.
|
32
29
|
email:
|
33
30
|
- alex.hal9000@gmail.com
|
@@ -41,6 +38,7 @@ files:
|
|
41
38
|
- .ruby-gemset
|
42
39
|
- .ruby-version
|
43
40
|
- .travis.yml
|
41
|
+
- CHANGELOG.md
|
44
42
|
- Gemfile
|
45
43
|
- LICENSE
|
46
44
|
- README.md
|
@@ -78,36 +76,27 @@ files:
|
|
78
76
|
homepage: https://github.com/ThoughtWorksStudios/eb_deployer
|
79
77
|
licenses:
|
80
78
|
- MIT
|
81
|
-
|
79
|
+
metadata: {}
|
80
|
+
post_install_message:
|
82
81
|
rdoc_options: []
|
83
82
|
require_paths:
|
84
83
|
- lib
|
85
84
|
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
-
none: false
|
87
85
|
requirements:
|
88
|
-
- -
|
86
|
+
- - '>='
|
89
87
|
- !ruby/object:Gem::Version
|
90
88
|
version: '0'
|
91
|
-
segments:
|
92
|
-
- 0
|
93
|
-
hash: 1041206842017006108
|
94
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
-
none: false
|
96
90
|
requirements:
|
97
|
-
- -
|
91
|
+
- - '>='
|
98
92
|
- !ruby/object:Gem::Version
|
99
93
|
version: '0'
|
100
|
-
segments:
|
101
|
-
- 0
|
102
|
-
hash: 1041206842017006108
|
103
94
|
requirements: []
|
104
|
-
rubyforge_project:
|
105
|
-
rubygems_version:
|
106
|
-
signing_key:
|
107
|
-
specification_version:
|
108
|
-
summary: Low friction deployments should be a breeze. Elastic Beanstalk provides a
|
109
|
-
great foundation for performing Blue-Green deployments, and EbDeployer add a missing
|
110
|
-
top to automate the whole flow out of the box.
|
95
|
+
rubyforge_project:
|
96
|
+
rubygems_version: 2.2.1
|
97
|
+
signing_key:
|
98
|
+
specification_version: 4
|
99
|
+
summary: Low friction deployments should be a breeze. Elastic Beanstalk provides a great foundation for performing Blue-Green deployments, and EbDeployer add a missing top to automate the whole flow out of the box.
|
111
100
|
test_files:
|
112
101
|
- test/aws_driver_stubs.rb
|
113
102
|
- test/cloud_formation_provisioner_test.rb
|
@@ -116,4 +105,4 @@ test_files:
|
|
116
105
|
- test/eb_environment_test.rb
|
117
106
|
- test/smoke_test_test.rb
|
118
107
|
- test/test_helper.rb
|
119
|
-
has_rdoc:
|
108
|
+
has_rdoc:
|