eb_deployer 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,6 +7,7 @@ Gem::Specification.new do |gem|
7
7
  gem.description = %q{For automate blue green deployment flow on Elasti Beanstalk.}
8
8
  gem.summary = %q{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 box.}
9
9
  gem.homepage = "https://github.com/ThoughtWorksStudios/eb_deployer"
10
+ gem.license = 'MIT'
10
11
 
11
12
  gem.add_runtime_dependency 'aws-sdk'
12
13
  gem.add_development_dependency 'minitest'
@@ -31,7 +31,7 @@ module EbDeployer
31
31
  # @option opts [Symbol] :application application name
32
32
  # @option opts [Symbol] :environment environment name (e.g. staging, production)
33
33
  # @option opts [Symbol] :region AWS Region (e.g. "us-west-2", "us-east-1")
34
- #
34
+ #
35
35
  def self.query_resource_output(key, opts)
36
36
  # AWS.config(:logger => Logger.new($stdout))
37
37
  if region = opts[:region]
@@ -45,7 +45,7 @@ module EbDeployer
45
45
  end
46
46
 
47
47
 
48
- #
48
+ #
49
49
  # Deploy a package to specfied environments on elastic beanstalk
50
50
  #
51
51
  # @param [Hash] opts
@@ -112,6 +112,11 @@ module EbDeployer
112
112
  #
113
113
  # @option opts [Symbol] :settings See `option_settings`
114
114
  #
115
+ # @option opts [Symbol] :package_bucket Name of s3 bucket where uploaded application
116
+ # packages will be stored. Note that the string ".packages" will be added as
117
+ # a suffix to your bucket. So, if "thoughtworks.simple" is passed as the bucket name,
118
+ # the actual s3 bucket name will be thoughtworks.simple.packages.
119
+ #
115
120
  # @option opts [Symbol] :smoke_test Value should be a proc or a lambda which
116
121
  # accept single argument that will passed in as environment DNS name. Smoke
117
122
  # test proc or lambda will be called at the end of the deployment for
@@ -166,8 +171,9 @@ module EbDeployer
166
171
  cname_prefix = opts[:cname_prefix] || [app, env_name].join('-')
167
172
  smoke_test = opts[:smoke_test] || Proc.new {}
168
173
  phoenix_mode = opts[:phoenix_mode]
174
+ bucket = opts[:package_bucket] || app
169
175
 
170
- application = Application.new(app, bs, s3)
176
+ application = Application.new(app, bs, s3, bucket)
171
177
 
172
178
  cf = CloudFormationProvisioner.new("#{app}-#{env_name}", cf)
173
179
 
@@ -1,16 +1,17 @@
1
1
  module EbDeployer
2
2
  class Application
3
- def initialize(name, eb_driver, s3_driver)
3
+ def initialize(name, eb_driver, s3_driver, bucket = nil)
4
4
  @name = name
5
5
  @eb_driver = eb_driver
6
6
  @s3_driver = s3_driver
7
+ @bucket = bucket
7
8
  raise "application name can only contain any combination of uppercase letters, lowercase letters, numbers, dashes (-)" unless @name =~ /^[a-zA-Z0-9.-]+$/
8
9
  end
9
10
 
10
11
  def create_version(version_label, package)
11
12
  create_application_if_not_exists
12
13
 
13
- package = Package.new(package, @name + "-packages", @s3_driver)
14
+ package = Package.new(package, @bucket + ".packages", @s3_driver)
14
15
  package.upload
15
16
 
16
17
  unless @eb_driver.application_version_labels.include?(version_label)
@@ -18,6 +18,12 @@ common:
18
18
  # Default strategy is 'blue-green'.
19
19
  # strategy: blue-green
20
20
 
21
+ # Name of s3 bucket where uploaded application packages will be stored.
22
+ # Note that the string ".packages" will be added as a suffix to your bucket.
23
+ # So, if "thoughtworks.simple" is passed as the bucket name, the actual s3 bucket
24
+ # name will be thoughtworks.simple.packages. Default to application name.
25
+ # package_bucket: my-s3-bucket
26
+
21
27
  # If phoenix mode is turned 'on', it will terminate the old elastic
22
28
  # beanstalk environment and recreate a new one on deploy. For blue-green
23
29
  # deployment it will terminate the inactive environment first then
@@ -1,3 +1,3 @@
1
1
  module EbDeployer
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
@@ -30,6 +30,7 @@ YAML
30
30
  application: myapp
31
31
  common:
32
32
  strategy: inplace-update
33
+ package_bucket: thoughtworks
33
34
  phoenix_mode: true
34
35
  option_settings:
35
36
  - namespace: aws:autoscaling:launchconfiguration
@@ -41,6 +42,7 @@ environments:
41
42
  production:
42
43
  YAML
43
44
  assert_equal('inplace-update', config[:strategy])
45
+ assert_equal('thoughtworks', config[:package_bucket])
44
46
  assert_equal([{'namespace' => 'aws:autoscaling:launchconfiguration',
45
47
  'option_name' => 'InstanceType',
46
48
  'value' => 'm1.small'}], config[:option_settings])
@@ -195,6 +195,13 @@ class DeployTest < Minitest::Test
195
195
  assert_equal({'a' => 1 }, @cf_driver.stack_config('simple-production')[:parameters])
196
196
  end
197
197
 
198
+ def test_set_s3_bucket_name_on_deployment
199
+ deploy(:application => 'simple',
200
+ :environment => "production",
201
+ :package_bucket => 'thoughtworks.simple')
202
+
203
+ assert @s3_driver.bucket_exists?('thoughtworks.simple.packages')
204
+ end
198
205
 
199
206
  def test_transforms_resource_provsion_output_to_elastic_beanstalk_settings
200
207
  cf_template = temp_file(JSON.dump({
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.2.5
4
+ version: 0.2.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-10-01 00:00:00.000000000 Z
13
+ date: 2013-10-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: aws-sdk
@@ -84,7 +84,8 @@ files:
84
84
  - test/smoke_test_test.rb
85
85
  - test/test_helper.rb
86
86
  homepage: https://github.com/ThoughtWorksStudios/eb_deployer
87
- licenses: []
87
+ licenses:
88
+ - MIT
88
89
  post_install_message:
89
90
  rdoc_options: []
90
91
  require_paths: