Method: Jets::Commands::Deploy#exit_unless_updateable!

Defined in:
lib/jets/commands/deploy.rb

#exit_unless_updateable!Object



154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/jets/commands/deploy.rb', line 154

def exit_unless_updateable!
  return if ENV['JETS_FORCE_UPDATEABLE'] # useful for debugging if stack stack updating

  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$/
    region = `aws configure get region`.strip rescue "us-east-1"
    url = "https://console.aws.amazon.com/cloudformation/home?region=#{region}#/stacks"
    puts "The parent stack of the #{Jets.config.project_name.color(:green)} project is not in an updateable state."
    puts "Stack name #{stack_name.color(:yellow)} status #{stack["stack_status"].color(:yellow)}"
    puts "Here's the CloudFormation url to check for more details #{url}"
    exit 1
  end
end