eb_deployer 0.3.9 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ 0.4.0
2
+ ====
3
+ * revert back all changes from 0.3.8 to 0.3.9. Elasticbeanstalk haven't relex the real unique constain. The actually contrain is you can not have environment name cross different application
4
+
1
5
  0.3.9
2
6
  ====
3
7
  * Fix hang problem introduced in 0.3.8 when migrating old ElasticBeanstalk environment.
@@ -1,23 +1,22 @@
1
1
  module EbDeployer
2
2
  class EbEnvironment
3
- attr_reader :app, :name, :legacy_env_name
3
+ attr_reader :app, :name
4
4
  attr_writer :event_poller
5
5
 
6
- def self.legacy_ebenv_name(app_name, env_name)
6
+ def self.unique_ebenv_name(env_name, app_name)
7
+ raise "Environment name #{env_name} is too long, it must be under 15 chars" if env_name.size > 15
7
8
  digest = Digest::SHA1.hexdigest(app_name + '-' + env_name)[0..6]
8
9
  "#{env_name}-#{digest}"
9
10
  end
10
11
 
11
12
  def initialize(app, name, eb_driver, creation_opts={})
12
13
  @app = app
13
- @name = name
14
+ @name = self.class.unique_ebenv_name(name, app)
14
15
  @bs = eb_driver
15
16
  @creation_opts = creation_opts
16
- @legacy_env_name = self.class.legacy_ebenv_name(@app, @name)
17
17
  end
18
18
 
19
19
  def deploy(version_label, settings={})
20
- terminate_legacy_env
21
20
  terminate if @creation_opts[:phoenix_mode]
22
21
  create_or_update_env(version_label, settings)
23
22
  smoke_test
@@ -25,12 +24,12 @@ module EbDeployer
25
24
  end
26
25
 
27
26
  def cname_prefix
28
- @bs.environment_cname_prefix(@app, defactor_env_name)
27
+ @bs.environment_cname_prefix(@app, @name)
29
28
  end
30
29
 
31
30
  def swap_cname_with(another)
32
31
  log("Swap CNAME with env #{another.name}")
33
- @bs.environment_swap_cname(self.app, self.defactor_env_name, another.defactor_env_name)
32
+ @bs.environment_swap_cname(self.app, self.name, another.name)
34
33
  end
35
34
 
36
35
  def log(msg)
@@ -38,30 +37,15 @@ module EbDeployer
38
37
  end
39
38
 
40
39
  def terminate
41
- env_name = defactor_env_name
42
- if @bs.environment_exists?(@app, env_name)
43
- with_polling_events(env_name, /terminateEnvironment completed successfully/i) do
44
- @bs.delete_environment(@app, env_name)
40
+ if @bs.environment_exists?(@app, @name)
41
+ with_polling_events(@name, /terminateEnvironment completed successfully/i) do
42
+ @bs.delete_environment(@app, @name)
45
43
  end
46
44
  end
47
45
  end
48
46
 
49
- def defactor_env_name
50
- @bs.environment_exists?(@app, @legacy_env_name) ? @legacy_env_name : @name
51
- end
52
-
53
47
  private
54
48
 
55
- def terminate_legacy_env
56
- if @bs.environment_exists?(@app, @legacy_env_name)
57
- log("Found legacy environment '#{@legacy_env_name}', eb_deployer will terminate it and create new environment following new name pattern as '#{@name}'.")
58
-
59
- with_polling_events(@legacy_env_name, /terminateEnvironment completed successfully/i) do
60
- @bs.delete_environment(@app, @legacy_env_name)
61
- end
62
- end
63
- end
64
-
65
49
  def create_or_update_env(version_label, settings)
66
50
  if @bs.environment_exists?(@app, @name)
67
51
  with_polling_events(@name, /Environment update completed successfully/i) do
@@ -1,3 +1,3 @@
1
1
  module EbDeployer
2
- VERSION = "0.3.9"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -7,8 +7,8 @@ class BlueGreenDeployTest < DeployTest
7
7
  :strategy => 'blue-green',
8
8
  :version_label => 42)
9
9
 
10
- assert @eb_driver.environment_exists?('simple', 'production-a')
11
- assert_equal 'simple-production', @eb_driver.environment_cname_prefix('simple', 'production-a')
10
+ assert @eb.environment_exists?('simple', t('production-a', 'simple'))
11
+ assert_equal 'simple-production', @eb.environment_cname_prefix('simple', t('production-a', 'simple'))
12
12
  end
13
13
 
14
14
 
@@ -23,8 +23,8 @@ class BlueGreenDeployTest < DeployTest
23
23
  :strategy => 'blue-green',
24
24
  :version_label => 43)
25
25
 
26
- assert @eb_driver.environment_exists?('simple', 'production-a')
27
- assert @eb_driver.environment_exists?('simple', 'production-b')
26
+ assert @eb.environment_exists?('simple', t('production-a', 'simple'))
27
+ assert @eb.environment_exists?('simple', t('production-b', 'simple'))
28
28
  end
29
29
 
30
30
 
@@ -39,9 +39,9 @@ class BlueGreenDeployTest < DeployTest
39
39
  :strategy => 'blue-green',
40
40
  :version_label => 43)
41
41
 
42
- assert_match(/simple-production-inactive/, @eb_driver.environment_cname_prefix('simple', 'production-a'))
42
+ assert_match(/simple-production-inactive/, @eb.environment_cname_prefix('simple', t('production-a', 'simple')))
43
43
 
44
- assert_equal 'simple-production', @eb_driver.environment_cname_prefix('simple', 'production-b')
44
+ assert_equal 'simple-production', @eb.environment_cname_prefix('simple', t('production-b', 'simple'))
45
45
 
46
46
 
47
47
  deploy(:application => 'simple',
@@ -49,9 +49,9 @@ class BlueGreenDeployTest < DeployTest
49
49
  :strategy => 'blue-green',
50
50
  :version_label => 44)
51
51
 
52
- assert_match(/simple-production-inactive/, @eb_driver.environment_cname_prefix('simple', 'production-b'))
52
+ assert_match(/simple-production-inactive/, @eb.environment_cname_prefix('simple', t('production-b', 'simple')))
53
53
 
54
- assert_equal 'simple-production', @eb_driver.environment_cname_prefix('simple', 'production-a')
54
+ assert_equal 'simple-production', @eb.environment_cname_prefix('simple', t('production-a', 'simple'))
55
55
  end
56
56
 
57
57
 
@@ -85,10 +85,10 @@ class BlueGreenDeployTest < DeployTest
85
85
  :version_label => 43,
86
86
  :phoenix_mode => true)
87
87
 
88
- assert_equal [], @eb_driver.environments_been_deleted('simple')
88
+ assert_equal [], @eb.environments_been_deleted('simple')
89
89
 
90
- inactive_env = 'production-a'
91
- assert_match(/inactive/, @eb_driver.environment_cname_prefix('simple', inactive_env))
90
+ inactive_env = t('production-a', 'simple')
91
+ assert_match(/inactive/, @eb.environment_cname_prefix('simple', inactive_env))
92
92
 
93
93
 
94
94
  deploy(:application => 'simple',
@@ -97,9 +97,9 @@ class BlueGreenDeployTest < DeployTest
97
97
  :version_label => 44,
98
98
  :phoenix_mode => true)
99
99
 
100
- assert_equal [inactive_env], @eb_driver.environments_been_deleted('simple')
100
+ assert_equal [inactive_env], @eb.environments_been_deleted('simple')
101
101
 
102
- assert_equal 'simple-production', @eb_driver.environment_cname_prefix('simple', inactive_env)
102
+ assert_equal 'simple-production', @eb.environment_cname_prefix('simple', inactive_env)
103
103
  end
104
104
 
105
105
 
data/test/deploy_test.rb CHANGED
@@ -2,7 +2,7 @@ require 'test_helper'
2
2
 
3
3
  class DeployTest < MiniTest::Unit::TestCase
4
4
  def setup
5
- @eb_driver = EBStub.new
5
+ @eb = EBStub.new
6
6
  @s3_driver = S3Stub.new
7
7
  @cf_driver = CFStub.new
8
8
  @sample_package = sample_file('app-package.war')
@@ -17,7 +17,7 @@ class DeployTest < MiniTest::Unit::TestCase
17
17
  end
18
18
 
19
19
  def query_resource_output(key, opts)
20
- EbDeployer.query_resource_output(key, {:bs_driver => @eb_driver,
20
+ EbDeployer.query_resource_output(key, {:bs_driver => @eb,
21
21
  :s3_driver => @s3_driver,
22
22
  :cf_driver => @cf_driver}.merge(opts))
23
23
  end
@@ -33,7 +33,7 @@ class DeployTest < MiniTest::Unit::TestCase
33
33
  end
34
34
 
35
35
  def stubs
36
- { :bs_driver => @eb_driver,
36
+ { :bs_driver => @eb,
37
37
  :s3_driver => @s3_driver,
38
38
  :cf_driver => @cf_driver
39
39
  }
@@ -1,24 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class EbEnvironmentTest < MiniTest::Unit::TestCase
4
- class PollerStub
5
- class Deadloop < StandardError; end
6
-
7
- def initialize(messages)
8
- start_time = Time.now.utc
9
- @events = messages.map do |message|
10
- start_time += 1
11
- {:event_date => start_time, :message => message}
12
- end
13
- end
14
-
15
-
16
- def poll(start_time = Time.now, &block)
17
- @events.each(&block)
18
- raise Deadloop.new('poll will never terminate if you do not set a break in the block')
19
- end
20
- end
21
-
22
4
  def setup
23
5
  @eb_driver = EBStub.new
24
6
  @eb_driver.create_application("myapp")
@@ -27,21 +9,21 @@ class EbEnvironmentTest < MiniTest::Unit::TestCase
27
9
  def test_deploy_should_create_corresponding_eb_env
28
10
  env = EbDeployer::EbEnvironment.new("myapp", "production", @eb_driver)
29
11
  env.deploy("version1")
30
- assert @eb_driver.environment_exists?('myapp', 'production')
12
+ assert @eb_driver.environment_exists?('myapp', t('production', 'myapp'))
31
13
  end
32
14
 
33
15
  def test_deploy_again_should_update_environment
34
16
  env = EbDeployer::EbEnvironment.new("myapp", "production", @eb_driver)
35
17
  env.deploy("version1")
36
18
  env.deploy("version2")
37
- assert @eb_driver.environment_exists?('myapp', 'production')
38
- assert_equal 'version2', @eb_driver.environment_verion_label('myapp', 'production')
19
+ assert @eb_driver.environment_exists?('myapp', t('production', 'myapp'))
20
+ assert_equal 'version2', @eb_driver.environment_verion_label('myapp', t('production', 'myapp'))
39
21
  end
40
22
 
41
23
  def test_option_setttings_get_set_on_eb_env
42
24
  env = EbDeployer::EbEnvironment.new("myapp", "production", @eb_driver)
43
25
  env.deploy("version1", {s1: 'v1'})
44
- assert_equal({s1: 'v1' }, @eb_driver.environment_settings('myapp', 'production'))
26
+ assert_equal({s1: 'v1' }, @eb_driver.environment_settings('myapp', t('production', 'myapp')))
45
27
  end
46
28
 
47
29
  def test_should_run_smoke_test_after_deploy
@@ -55,13 +37,13 @@ class EbEnvironmentTest < MiniTest::Unit::TestCase
55
37
 
56
38
  def test_should_raise_runtime_error_when_deploy_failed
57
39
  env = EbDeployer::EbEnvironment.new("myapp", "production", @eb_driver)
58
- @eb_driver.set_events("myapp", "production", ["start deploying", "Failed to deploy application"])
40
+ @eb_driver.set_events("myapp", t("production", 'myapp'), ["start deploying", "Failed to deploy application"])
59
41
  assert_raises(RuntimeError) { env.deploy("version 1") }
60
42
  end
61
43
 
62
44
  def test_should_raise_runtime_error_when_eb_extension_execution_failed
63
45
  env = EbDeployer::EbEnvironment.new("myapp", "production", @eb_driver)
64
- @eb_driver.set_events("myapp", "production", ["start deploying",
46
+ @eb_driver.set_events("myapp", t("production", 'myapp'), ["start deploying",
65
47
  "create environment",
66
48
  "Command failed on instance. Return code: 1 Output: Error occurred during build: Command hooks failed",
67
49
  "Successfully launched environment"])
@@ -74,65 +56,6 @@ class EbEnvironmentTest < MiniTest::Unit::TestCase
74
56
  env = EbDeployer::EbEnvironment.new("myapp", "production", @eb_driver)
75
57
  env.deploy("version1")
76
58
  env.terminate
77
- assert !@eb_driver.environment_exists?('myapp', 'production')
78
- end
79
-
80
- def test_should_terminate_legacy_env_upon_deployment
81
- legacy_env_name = create_legacy_env("myapp", "production", "myapp-production")
82
- env = EbDeployer::EbEnvironment.new("myapp", "production", @eb_driver)
83
- @eb_driver.set_events("myapp", legacy_env_name, ["terminateEnvironment completed successfully"])
84
- @eb_driver.set_events("myapp", "production", ["Successfully launched environment"])
85
- env.deploy("version1")
86
- assert !@eb_driver.environment_exists?("myapp", legacy_env_name)
87
- assert @eb_driver.environment_exists?("myapp", "production")
88
- end
89
-
90
- def test_can_find_cname_if_legacy_env_exists
91
- legacy_env_name = EbDeployer::EbEnvironment.legacy_ebenv_name("myapp", "production")
92
- @eb_driver.create_environment("myapp", legacy_env_name, 'solution-stack', 'myapp-production', 'foo', 'web' ,{})
93
- env = EbDeployer::EbEnvironment.new("myapp", "production", @eb_driver)
94
- assert_equal 'myapp-production', env.cname_prefix
95
- end
96
-
97
- def test_terminate_legacy_env
98
- legacy_env_name = create_legacy_env("myapp", "production", "myapp-production")
99
- env = EbDeployer::EbEnvironment.new("myapp", "production", @eb_driver)
100
- env.terminate
101
- assert !@eb_driver.environment_exists?("myapp", legacy_env_name)
102
- end
103
-
104
- def test_swap_legacy_env_with_non_legacy_env
105
- create_legacy_env("myapp", "production-a", "myapp-production")
106
- env_a = EbDeployer::EbEnvironment.new("myapp", "production-a", @eb_driver)
107
- env_b = EbDeployer::EbEnvironment.new("myapp", "production-b", @eb_driver, :cname_prefix => 'myapp-production-inactive')
108
- env_b.deploy('version1')
109
-
110
- env_a.swap_cname_with(env_b)
111
-
112
- assert_equal "myapp-production-inactive", env_a.cname_prefix
113
- assert_equal "myapp-production", env_b.cname_prefix
59
+ assert !@eb_driver.environment_exists?('myapp', t('production', 'myapp'))
114
60
  end
115
-
116
- def test_swap_no_legacy_env_with_legacy_env
117
- create_legacy_env("myapp", "production-a", "myapp-production")
118
- env_a = EbDeployer::EbEnvironment.new("myapp", "production-a", @eb_driver)
119
- env_b = EbDeployer::EbEnvironment.new("myapp", "production-b", @eb_driver, :cname_prefix => 'myapp-production-inactive')
120
- env_b.deploy('version1')
121
-
122
- env_b.swap_cname_with(env_a)
123
-
124
- assert_equal "myapp-production-inactive", env_a.cname_prefix
125
- assert_equal "myapp-production", env_b.cname_prefix
126
- end
127
-
128
- private
129
-
130
- def create_legacy_env(app_name, env_name, cname_prefix)
131
- legacy_env_name = EbDeployer::EbEnvironment.legacy_ebenv_name(app_name, env_name)
132
- @eb_driver.create_environment(app_name, legacy_env_name, 'solution-stack', cname_prefix, 'foo', 'web' ,{})
133
- legacy_env_name
134
- end
135
-
136
-
137
-
138
61
  end
@@ -2,9 +2,9 @@ require 'deploy_test'
2
2
 
3
3
  class InplaceUpdateDeployTest < DeployTest
4
4
  def test_first_deployment_create_eb_application
5
- assert !@eb_driver.application_exists?('simple')
5
+ assert !@eb.application_exists?('simple')
6
6
  deploy(:application => 'simple', :environment => "production")
7
- assert @eb_driver.application_exists?('simple')
7
+ assert @eb.application_exists?('simple')
8
8
  end
9
9
 
10
10
  def test_set_option_settings_on_deployment
@@ -14,26 +14,26 @@ class InplaceUpdateDeployTest < DeployTest
14
14
  deploy(:application => 'simple', :environment => "production",
15
15
  :option_settings => [redudant])
16
16
 
17
- assert_equal [redudant], @eb_driver.environment_settings('simple', 'production')
17
+ assert_equal [redudant], @eb.environment_settings('simple', t('production', 'simple'))
18
18
 
19
19
  end
20
20
 
21
21
  def test_destroy_should_clean_up_eb_application_and_env
22
22
  deploy(:application => 'simple', :environment => "production")
23
23
  destroy(:application => 'simple')
24
- assert !@eb_driver.application_exists?('simple')
25
- assert !@eb_driver.environment_exists?('simple', 'production')
24
+ assert !@eb.application_exists?('simple')
25
+ assert !@eb.environment_exists?('simple', t('production', 'simple'))
26
26
  end
27
27
 
28
28
  def test_first_deployment_create_environment
29
- assert !@eb_driver.environment_exists?('simple', 'production')
29
+ assert !@eb.environment_exists?('simple', t('production', 'simple'))
30
30
  deploy(:application => 'simple', :environment => "production")
31
- assert @eb_driver.environment_exists?('simple', 'production')
31
+ assert @eb.environment_exists?('simple', t('production', 'simple'))
32
32
  end
33
33
 
34
34
  def test_support_very_very_long_app_name
35
35
  deploy(:application => 'ver-very-simple-application', :environment => "production")
36
- assert @eb_driver.environment_exists?('ver-very-simple-application', 'production')
36
+ assert @eb.environment_exists?('ver-very-simple-application', t('production', 'ver-very-simple-application'))
37
37
  end
38
38
 
39
39
  def test_should_raise_error_when_env_name_is_too_long
@@ -44,13 +44,13 @@ class InplaceUpdateDeployTest < DeployTest
44
44
  deploy(:application => 'simple',
45
45
  :environment => "production",
46
46
  :version_label => 1)
47
- assert_equal '1', @eb_driver.environment_verion_label('simple', 'production')
47
+ assert_equal '1', @eb.environment_verion_label('simple', t('production', 'simple'))
48
48
 
49
49
  deploy(:application => 'simple',
50
50
  :environment => "production",
51
51
  :version_label => 2)
52
52
 
53
- assert_equal '2', @eb_driver.environment_verion_label('simple', 'production')
53
+ assert_equal '2', @eb.environment_verion_label('simple', t('production', 'simple'))
54
54
  end
55
55
 
56
56
  def test_smoke_test_should_be_run_after_env_created_or_update
@@ -74,12 +74,9 @@ class InplaceUpdateDeployTest < DeployTest
74
74
 
75
75
  def test_should_terminate_old_environment_if_phoenix_mode_is_enabled
76
76
  deploy(:application => 'simple', :environment => "production", :phoenix_mode => true)
77
- assert @eb_driver.environment_exists?('simple', 'production')
77
+ assert @eb.environment_exists?('simple', t('production', 'simple'))
78
78
  deploy(:application => 'simple', :environment => "production", :phoenix_mode => true)
79
- assert @eb_driver.environments_been_deleted('simple').include?('production')
80
- assert @eb_driver.environment_exists?('simple', 'production')
79
+ assert @eb.environments_been_deleted('simple').include?(t('production', 'simple'))
80
+ assert @eb.environment_exists?('simple', t('production', 'simple'))
81
81
  end
82
-
83
-
84
-
85
82
  end
@@ -74,7 +74,7 @@ class ResourcesDeployTest < DeployTest
74
74
  }
75
75
  })
76
76
 
77
- assert @eb_driver.environment_settings('simple', 'production').
77
+ assert @eb.environment_settings('simple', t('production', 'simple')).
78
78
  include?({:namespace => 'aws.foo', :option_name => 'o2', :value => 'transformed value of O2'})
79
79
  end
80
80
 
@@ -91,7 +91,7 @@ class ResourcesDeployTest < DeployTest
91
91
  'O1' => lambda { |v| {:namespace => 'aws.foo', :option_name => 'o1', :value => v} }
92
92
  }
93
93
  })
94
- assert @eb_driver.environment_settings('simple', 'production').
94
+ assert @eb.environment_settings('simple', t('production', 'simple')).
95
95
  include?({:namespace => 'aws.foo', :option_name => 'o1', :value => 'value of O1'})
96
96
  end
97
97
 
data/test/test_helper.rb CHANGED
@@ -13,4 +13,8 @@ class MiniTest::Unit::TestCase
13
13
  File.open(path, 'w') { |f| f << content }
14
14
  path
15
15
  end
16
+
17
+ def t(env, app_name)
18
+ EbDeployer::EbEnvironment.unique_ebenv_name(env, app_name)
19
+ end
16
20
  end
@@ -3,12 +3,12 @@ require 'deploy_test'
3
3
  class TierSettingDeployTest < DeployTest
4
4
  def test_sets_default_tier_as_webserver
5
5
  deploy(:application => 'simple', :environment => "production")
6
- assert_equal EbDeployer.environment_tier('WebServer'), @eb_driver.environment_tier('simple', 'production')
6
+ assert_equal EbDeployer.environment_tier('WebServer'), @eb.environment_tier('simple', t('production', 'simple'))
7
7
  end
8
8
 
9
9
  def test_can_change_tier
10
10
  deploy(:application => 'simple', :environment => "production", :tier => 'Worker')
11
- assert_equal EbDeployer.environment_tier('Worker'), @eb_driver.environment_tier('simple', 'production')
11
+ assert_equal EbDeployer.environment_tier('Worker'), @eb.environment_tier('simple', t('production', 'simple'))
12
12
  end
13
13
 
14
14
  def test_should_raise_error_when_tier_setting_is_not_recognized
@@ -10,8 +10,8 @@ class VersionsDeployTest < DeployTest
10
10
 
11
11
  deploy(:application => 'simple', :environment => "production",
12
12
  :package => 'mingle_package.yml', :version_label => 1)
13
- assert @eb_driver.application_exists?('simple')
14
- last_version = @eb_driver.application_versions('simple').last
13
+ assert @eb.application_exists?('simple')
14
+ last_version = @eb.application_versions('simple').last
15
15
  assert_equal({'s3_bucket' => 'test-bucket', 's3_key' => 'test-mingle.war'}, last_version[:source_bundle])
16
16
  ensure
17
17
  FileUtils.rm_rf('mingle_package.yml')
@@ -24,7 +24,7 @@ class VersionsDeployTest < DeployTest
24
24
  :environment => "production",
25
25
  :version_label => 1,
26
26
  :version_prefix => "prod-")
27
- assert_equal 'prod-1', @eb_driver.environment_verion_label('simple', 'production')
27
+ assert_equal 'prod-1', @eb.environment_verion_label('simple', t('production', 'simple'))
28
28
  end
29
29
 
30
30
  def test_should_keep_only_number_of_versions_specified
@@ -41,7 +41,7 @@ class VersionsDeployTest < DeployTest
41
41
  :version_label => 3,
42
42
  :keep_latest => 2)
43
43
 
44
- assert_equal '1', @eb_driver.versions_deleted('simple').first
44
+ assert_equal '1', @eb.versions_deleted('simple').first
45
45
  end
46
46
 
47
47
  def test_should_only_remove_versions_with_matching_prefix
@@ -61,10 +61,10 @@ class VersionsDeployTest < DeployTest
61
61
  :version_prefix => "prod2-",
62
62
  :keep_latest => 1)
63
63
 
64
- assert_equal 'prod1-1', @eb_driver.versions_deleted('simple').first
65
- assert_equal 1, @eb_driver.versions_deleted('simple').count
64
+ assert_equal 'prod1-1', @eb.versions_deleted('simple').first
65
+ assert_equal 1, @eb.versions_deleted('simple').count
66
66
 
67
- app_versions = @eb_driver.application_versions('simple').map { |apv| apv[:version_label] }
67
+ app_versions = @eb.application_versions('simple').map { |apv| apv[:version_label] }
68
68
  assert_equal ["prod1-2", "prod2-1"], app_versions
69
69
  end
70
70
 
@@ -72,7 +72,7 @@ class VersionsDeployTest < DeployTest
72
72
  deploy(:application => 'simple',
73
73
  :environment => "production",
74
74
  :version_label => 42)
75
- assert_equal "simple-production", @eb_driver.environment_cname_prefix('simple', 'production')
75
+ assert_equal "simple-production", @eb.environment_cname_prefix('simple', t('production', 'simple'))
76
76
  end
77
77
 
78
78
  def test_cname_prefix_can_be_override
@@ -80,7 +80,7 @@ class VersionsDeployTest < DeployTest
80
80
  :environment => "production",
81
81
  :cname_prefix => 'sports123',
82
82
  :version_label => 42)
83
- assert_equal "sports123", @eb_driver.environment_cname_prefix('simple', 'production')
83
+ assert_equal "sports123", @eb.environment_cname_prefix('simple', t('production', 'simple'))
84
84
  end
85
85
 
86
86
  def test_pass_s3_object_name_as_package_file
@@ -91,8 +91,8 @@ class VersionsDeployTest < DeployTest
91
91
  :environment => "production",
92
92
  :version_label => 1)
93
93
 
94
- assert @eb_driver.application_exists?('simple')
95
- last_version = @eb_driver.application_versions('simple').last
94
+ assert @eb.application_exists?('simple')
95
+ last_version = @eb.application_versions('simple').last
96
96
  assert_equal({'s3_bucket' => 'test-bucket', 's3_key' => 'test-mingle.war'}, last_version[:source_bundle])
97
97
  end
98
98
 
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eb_deployer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.4.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - wpc
@@ -14,6 +15,7 @@ dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: aws-sdk
16
17
  requirement: !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
20
  - - ! '>='
19
21
  - !ruby/object:Gem::Version
@@ -21,6 +23,7 @@ dependencies:
21
23
  type: :runtime
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
28
  - - ! '>='
26
29
  - !ruby/object:Gem::Version
@@ -73,7 +76,6 @@ files:
73
76
  - test/deploy_test.rb
74
77
  - test/eb_environment_test.rb
75
78
  - test/inplace_update_deploy_test.rb
76
- - test/legacy_env_migrate_deploy_test.rb
77
79
  - test/resources_deploy_test.rb
78
80
  - test/smoke_test_test.rb
79
81
  - test/test_helper.rb
@@ -82,26 +84,33 @@ files:
82
84
  homepage: https://github.com/ThoughtWorksStudios/eb_deployer
83
85
  licenses:
84
86
  - MIT
85
- metadata: {}
86
87
  post_install_message:
87
88
  rdoc_options: []
88
89
  require_paths:
89
90
  - lib
90
91
  required_ruby_version: !ruby/object:Gem::Requirement
92
+ none: false
91
93
  requirements:
92
94
  - - ! '>='
93
95
  - !ruby/object:Gem::Version
94
96
  version: '0'
97
+ segments:
98
+ - 0
99
+ hash: 177644489298089087
95
100
  required_rubygems_version: !ruby/object:Gem::Requirement
101
+ none: false
96
102
  requirements:
97
103
  - - ! '>='
98
104
  - !ruby/object:Gem::Version
99
105
  version: '0'
106
+ segments:
107
+ - 0
108
+ hash: 177644489298089087
100
109
  requirements: []
101
110
  rubyforge_project:
102
- rubygems_version: 2.2.0
111
+ rubygems_version: 1.8.29
103
112
  signing_key:
104
- specification_version: 4
113
+ specification_version: 3
105
114
  summary: Low friction deployments should be a breeze. Elastic Beanstalk provides a
106
115
  great foundation for performing Blue-Green deployments, and EbDeployer add a missing
107
116
  top to automate the whole flow out of the box.
@@ -113,7 +122,6 @@ test_files:
113
122
  - test/deploy_test.rb
114
123
  - test/eb_environment_test.rb
115
124
  - test/inplace_update_deploy_test.rb
116
- - test/legacy_env_migrate_deploy_test.rb
117
125
  - test/resources_deploy_test.rb
118
126
  - test/smoke_test_test.rb
119
127
  - test/test_helper.rb
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZTFkZGMyNGQ3YTg2ZjRjMGM1ZTE0OGIwMDk5ZTQ0ZDgwY2MyMWJhNw==
5
- data.tar.gz: !binary |-
6
- YmZkZmQ3MTFiZDQ2YjQxMjg4OWM0NWZmMzk3MzZiOTY2YmM5MzdlZQ==
7
- SHA512:
8
- metadata.gz: !binary |-
9
- YTAxZjdhNmEwZTcwMjYyNzA2MzY1Zjg5ZDM2ZDhiNmQzN2M1Y2M0Mjk0ZjQy
10
- YTczYzEzNDQ1ODAxMTkwOTVlZTc5YmQwZDkxN2JkY2IwNmVmY2U4MWUzMzEx
11
- Y2JlMGJjMmI3ZTJiZjQ1OWM5Yzk3NTcyMTdlNmMzMDYyMGY5NjE=
12
- data.tar.gz: !binary |-
13
- ZTE5MjFiODhmNjA0MjFmNmQyMTJhMmYwMWRiYjM1ODdlNWYyOWMxYzExZTZi
14
- OTY1ZmI2ZjkyMjA5ZGM0NTQzMTQ1MTkwZjI3MjY5N2UyOTQyNjRiZTc2OTk3
15
- ZWVmNDQxNTcxNDk5ZTljMGE5YjdlMDZiM2M4NmQxMmMxYjVjNDM=
@@ -1,94 +0,0 @@
1
- require 'deploy_test'
2
- class LegacyEnvMigrateDeployTest < DeployTest
3
-
4
- def setup
5
- super
6
- @eb_driver.create_application("simple")
7
- end
8
-
9
- def test_should_clean_up_legacy_environment_in_inplace_update_deployment
10
- legacy_env_name = EbDeployer::EbEnvironment.legacy_ebenv_name("simple", "production")
11
- @eb_driver.create_environment("simple", legacy_env_name, 'solution-stack', 'simple-production', 'foo', 'web' ,{})
12
- deploy(:application => 'simple',
13
- :environment => 'production',
14
- :version_label => 1)
15
- assert @eb_driver.environment_exists?("simple", "production")
16
- assert !@eb_driver.environment_exists?("simple", legacy_env_name)
17
- end
18
-
19
- def test_should_clean_up_legacy_environment_in_blue_green_deployment
20
- legacy_a_env_name = EbDeployer::EbEnvironment.legacy_ebenv_name("simple", "production-a")
21
- legacy_b_env_name = EbDeployer::EbEnvironment.legacy_ebenv_name("simple", "production-b")
22
-
23
- @eb_driver.create_environment("simple", legacy_a_env_name, 'solution-stack', 'simple-production', 'foo', 'web' ,{})
24
- @eb_driver.create_environment("simple", legacy_b_env_name, 'solution-stack', 'simple-production-inactive', 'foo', 'web' ,{})
25
-
26
- deploy(:application => 'simple',
27
- :environment => 'production',
28
- :strategy => 'blue-green')
29
-
30
-
31
- assert !@eb_driver.environment_exists?("simple", legacy_b_env_name)
32
- assert @eb_driver.environment_exists?("simple", legacy_a_env_name)
33
-
34
- assert @eb_driver.environment_exists?("simple", "production-b")
35
- assert !@eb_driver.environment_exists?("simple", "production-a")
36
-
37
- assert_equal 'simple-production', @eb_driver.environment_cname_prefix('simple', 'production-b')
38
- assert_equal 'simple-production-inactive', @eb_driver.environment_cname_prefix('simple', legacy_a_env_name)
39
-
40
- deploy(:application => 'simple',
41
- :environment => 'production',
42
- :strategy => :blue_green)
43
-
44
- assert @eb_driver.environment_exists?("simple", "production-a")
45
- assert @eb_driver.environment_exists?("simple", "production-b")
46
- assert !@eb_driver.environment_exists?("simple", legacy_a_env_name)
47
- assert !@eb_driver.environment_exists?("simple", legacy_b_env_name)
48
-
49
- assert_equal 'simple-production', @eb_driver.environment_cname_prefix('simple', 'production-a')
50
- assert_equal 'simple-production-inactive', @eb_driver.environment_cname_prefix('simple', 'production-b')
51
- end
52
-
53
- def test_should_clean_up_legacy_environment_in_blue_green_deployment_when_only_active_en_is_there
54
- legacy_a_env_name = EbDeployer::EbEnvironment.legacy_ebenv_name("simple", "production-a")
55
- legacy_b_env_name = EbDeployer::EbEnvironment.legacy_ebenv_name("simple", "production-b")
56
- @eb_driver.create_environment("simple", legacy_a_env_name, 'solution-stack', 'simple-production', 'foo', 'web' ,{})
57
-
58
- deploy(:application => 'simple',
59
- :environment => 'production',
60
- :strategy => 'blue-green')
61
-
62
-
63
- assert @eb_driver.environment_exists?("simple", "production-b")
64
- assert !@eb_driver.environment_exists?("simple", "production-a")
65
- assert !@eb_driver.environment_exists?("simple", legacy_b_env_name)
66
- assert @eb_driver.environment_exists?("simple", legacy_a_env_name)
67
-
68
- assert_equal 'simple-production', @eb_driver.environment_cname_prefix('simple', 'production-b')
69
- assert_equal 'simple-production-inactive', @eb_driver.environment_cname_prefix('simple', legacy_a_env_name)
70
-
71
- deploy(:application => 'simple',
72
- :environment => 'production',
73
- :strategy => 'blue-green')
74
-
75
- assert @eb_driver.environment_exists?("simple", "production-a")
76
- assert @eb_driver.environment_exists?("simple", "production-b")
77
- assert !@eb_driver.environment_exists?("simple", legacy_a_env_name)
78
- assert !@eb_driver.environment_exists?("simple", legacy_b_env_name)
79
-
80
- assert_equal 'simple-production', @eb_driver.environment_cname_prefix('simple', 'production-a')
81
- assert_equal 'simple-production-inactive', @eb_driver.environment_cname_prefix('simple', 'production-b')
82
-
83
- end
84
-
85
- def test_terminate_legacy_environments
86
- legacy_a_env_name = EbDeployer::EbEnvironment.legacy_ebenv_name("simple", "production-a")
87
- legacy_b_env_name = EbDeployer::EbEnvironment.legacy_ebenv_name("simple", "production-b")
88
- @eb_driver.create_environment("simple", legacy_a_env_name, 'solution-stack', 'simple-production', 'foo', 'web' ,{})
89
- destroy(:application => 'simple')
90
-
91
- assert !@eb_driver.environment_exists?("simple", legacy_a_env_name)
92
- assert !@eb_driver.environment_exists?("simple", legacy_b_env_name)
93
- end
94
- end