Class: Deis::Commands::Deploy

Inherits:
Struct
  • Object
show all
Includes:
Helpers
Defined in:
lib/deis/commands/deploy.rb

Overview

Deploy a deis repo

Constant Summary collapse

LAST_MIGRATION_CMD =
%{bundle exec rake db:migrate:status}
MIGRATION_REGEX =
/up\s+(?<migration>[0-9]{8}[0-9])+/

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#app_exists?, #capture_output, #capture_syscall, #deis_command, #deis_local_command, #deis_login!, #deploy, #get_runner, #get_units!, #git_clone, #increment_retry!, #reset_retry!, #run_util, #scale, seconds_to_human, #shell, #should_retry?, #status, #units

Instance Attribute Details

#appObject

Returns the value of attribute app

Returns:

  • (Object)

    the current value of app



4
5
6
# File 'lib/deis/commands/deploy.rb', line 4

def app
  @app
end

#refObject

Returns the value of attribute ref

Returns:

  • (Object)

    the current value of ref



4
5
6
# File 'lib/deis/commands/deploy.rb', line 4

def ref
  @ref
end

#web_countObject (readonly)

Returns the value of attribute web_count.



11
12
13
# File 'lib/deis/commands/deploy.rb', line 11

def web_count
  @web_count
end

#worker_countObject (readonly)

Returns the value of attribute worker_count.



10
11
12
# File 'lib/deis/commands/deploy.rb', line 10

def worker_count
  @worker_count
end

Instance Method Details

#runObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/deis/commands/deploy.rb', line 13

def run
  status "Deploying `#{ref}` to `#{app}` on Deis"
  precheck_migrations!
  output = deploy info['git_url'], ref: ref
  if output.include? 'Another git push is ongoing'
    sleep 60 # one minute
    return run_util 'deploy', app, ref
  end
  run_migrations! if needs_migrations?
rescue NonZeroExitError => e
  raise e unless e.message.include? 'Another git push is ongoing'
  remove_instance_variable :@needs_migrations
  sleep 60
  retry
end