Class: Shipitron::Client::RunEcsTasks
- Inherits:
-
Object
- Object
- Shipitron::Client::RunEcsTasks
- Includes:
- Metaractor, EcsClient
- Defined in:
- lib/shipitron/client/run_ecs_tasks.rb
Instance Method Summary collapse
Methods included from EcsClient
#ecs_client, #generate_ecs_client
Instance Method Details
#call ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/shipitron/client/run_ecs_tasks.rb', line 41 def call Logger.info "Skipping ECS run_task calls due to --simulate" if simulate? Logger.info "Deploying to:" pastel = Pastel.new table = TTY::Table.new do |t| clusters.each_with_index do |cluster, i| if i == 0 t << [pastel.yellow('*'), cluster.name, cluster.region, '[' + pastel.green('shipitron') + ']'] else t << ['', cluster.name, cluster.region, ''] end end end table.render.each_line do |line| Logger.info line.chomp end cluster = clusters.first begin if simulate? command_args(cluster) return end response = ecs_client(region: cluster.region).run_task( cluster: cluster.name, task_definition: shipitron_task, overrides: { container_overrides: [ { name: 'shipitron', command: command_args(cluster) } ] }, count: 1, started_by: Shipitron::Client::STARTED_BY ) if !response.failures.empty? response.failures.each do |failure| fail_with_error! message: "ECS run_task failure: #{failure.arn}: #{failure.reason}" end end rescue Aws::ECS::Errors::ServiceError => e fail_with_errors!(messages: [ "Error: #{e.}", e.backtrace.join("\n") ]) end end |