Class: ContainerShip::Command::ExecCommand

Inherits:
Object
  • Object
show all
Includes:
Modules::Cloudwatch, Modules::Docker, Modules::Ecs, Modules::PrintTask
Defined in:
lib/container_ship/command/exec_command.rb

Instance Method Summary collapse

Methods included from Modules::Ecs

#register, #run_task, #update_service, #wait_task

Methods included from Modules::Docker

#push_image

Methods included from Modules::Cloudwatch

#show_log

Instance Method Details

#run(cluster_name, task_name, environment, build_number, timeout: nil, no_wait: false) ⇒ Object

rubocop:disable Metrics/ParameterLists



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/container_ship/command/exec_command.rb', line 20

def run(cluster_name, task_name, environment, build_number, timeout: nil, no_wait: false) # rubocop:disable Metrics/ParameterLists
  task_definition = TaskDefinition.new(cluster_name, 'tasks', task_name, environment, build_number)

  push_image task_definition

  revision = print_around_task('Registering task definition... ') do
    register task_definition
  end

  task_arn = print_around_task('Sending task request... ') do
    run_task task_definition, revision
  end

  return if no_wait

  exit_status = print_around_task('Waiting task is completed... ') do
    wait_task task_definition, task_arn, timeout: timeout
  end

  show_log task_definition, task_arn

  exit exit_status
end