diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6f21593..fd23349 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,10 +10,9 @@ jobs: fail-fast: false matrix: ruby: - - 2.7 - - 3.0 - - 3.1 - 3.2 + - 3.3 + - 3.4 os: - ubuntu-latest name: Ruby ${{ matrix.ruby }} unit testing on ${{ matrix.os }} diff --git a/lib/wrapbox/runner/ecs.rb b/lib/wrapbox/runner/ecs.rb index ee598a5..7345c89 100644 --- a/lib/wrapbox/runner/ecs.rb +++ b/lib/wrapbox/runner/ecs.rb @@ -28,6 +28,7 @@ class LackResource < StandardError; end WAIT_DELAY = 5 TERM_TIMEOUT = 120 HOST_TERMINATED_REASON_REGEXP = /Host EC2.*terminated/ + SPOT_TASK_INTERRUPTED = /Your Spot Task was interrupted/ attr_reader \ :name, @@ -243,12 +244,17 @@ def run_task(task_definition_arn, command, environments, parameter) # If exit_code is nil, Container is force killed or ECS failed to launch Container by Irregular situation error_message = build_error_message(task_definition_name, task.task_arn, task_status) + if task_status[:stopped_reason] =~ SPOT_TASK_INTERRUPTED + @logger.warn("#{log_prefix}#{task_status[:stopped_reason]}") + raise ContainerAbnormalEnd, error_message + end raise ContainerAbnormalEnd, error_message unless task_status[:exit_code] raise ExecutionFailure, error_message unless task_status[:exit_code] == 0 true rescue ContainerAbnormalEnd retry if task_status[:stopped_reason] =~ HOST_TERMINATED_REASON_REGEXP + retry if task_status[:stopped_reason] =~ SPOT_TASK_INTERRUPTED if execution_try_count >= parameter.execution_retry raise