Sha256: f4c11be1101f92265caba5fe4174a5863f62d2a6862338f06882ef4c453e08e8
Contents?: true
Size: 1.65 KB
Versions: 4
Compression:
Stored size: 1.65 KB
Contents
module Jets::Commands class Deploy include StackInfo include Jets::Timing def initialize(options) @options = options end def run deployment_env = Jets.config.project_namespace.colorize(:green) puts "Deploying to Lambda #{deployment_env} environment..." return if @options[:noop] build_code # first time will deploy minimal stack exit_unless_updateable! ship(stack_type: :minimal) if first_run? # deploy full nested stack when stack already exists ship(stack_type: :full, s3_bucket: s3_bucket) end time :run def build_code Jets::Commands::Build.new(@options).build_code end time :build_code def ship(stack_options) options = @options.merge(stack_options) # includes stack_type and s3_bucket Jets::Commands::Build.new(options).build_templates Jets::Cfn::Ship.new(options).run end time :ship # All CloudFormation states listed here: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-describing-stacks.html def exit_unless_updateable! stack_name = Jets::Naming.parent_stack_name exists = stack_exists?(stack_name) return unless exists # continue because stack could be updating stack = cfn.describe_stacks(stack_name: stack_name).stacks.first status = stack["stack_status"] if status =~ /^ROLLBACK_/ || status =~ /_IN_PROGRESS$/ puts "Parent stack associate with this '#{Jets.config.project_name}' project not in a updateable state.".colorize(:red) puts "Stack name #{stack_name} status #{stack["stack_status"]}" exit end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
jets-0.5.3 | lib/jets/commands/deploy.rb |
jets-0.5.2 | lib/jets/commands/deploy.rb |
jets-0.5.1 | lib/jets/commands/deploy.rb |
jets-0.5.0 | lib/jets/commands/deploy.rb |