Sha256: 0200ce1ba0b730af10d91a15f31b2c9483ba3753ca25e0b928644ec3c0fa22b4

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

require 'aws-sdk-ecs'
require 'json'
require 'open3'

require 'container_ship/command/modules/cloudwatch'
require 'container_ship/command/modules/docker'
require 'container_ship/command/modules/ecs'
require 'container_ship/command/modules/print_task'

module ContainerShip
  module Command
    class ExecCommand
      include Modules::Cloudwatch
      include Modules::Docker
      include Modules::Ecs
      include Modules::PrintTask

      def run(cluster_name, task_name, environment, build_number)
        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

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

        show_log task_definition, task_arn

        exit exit_status
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
container_ship-0.1.2 lib/container_ship/command/exec_command.rb
container_ship-0.1.1 lib/container_ship/command/exec_command.rb