Class: EcsDeployCli::Runners::UpdateServices

Inherits:
Base
  • Object
show all
Defined in:
lib/ecs_deploy_cli/runners/update_services.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #update_task

Constructor Details

This class inherits a constructor from EcsDeployCli::Runners::Base

Instance Method Details

#run!(service: nil, timeout: 500) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ecs_deploy_cli/runners/update_services.rb', line 6

def run!(service: nil, timeout: 500)
  services, resolved_tasks = @parser.resolve

  services.each do |service_name, service_definition|
    next if !service.nil? && service != service_name

    task_definition = _update_task resolved_tasks[service_definition.options[:task]]
    task_name = "#{task_definition[:family]}:#{task_definition[:revision]}"

    ecs_client.update_service(
      cluster: config[:cluster],
      service: service_name,
      task_definition: task_name
    )
    wait_for_deploy(service_name, task_name, timeout: timeout)
    EcsDeployCli.logger.info "Deployed service \"#{service_name}\"!"
  end
end