From 3bf623a91aaa1582260b6a11796eaf7ae5b3c992 Mon Sep 17 00:00:00 2001 From: Christian Bruckmayer Date: Tue, 26 Mar 2024 14:48:09 +0000 Subject: [PATCH] Only process retry queue on manual retries --- ruby/lib/minitest/queue/runner.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ruby/lib/minitest/queue/runner.rb b/ruby/lib/minitest/queue/runner.rb index c2be413b..462f5502 100644 --- a/ruby/lib/minitest/queue/runner.rb +++ b/ruby/lib/minitest/queue/runner.rb @@ -49,7 +49,8 @@ def retry_command def run_command require_worker_id! - if queue.retrying? || retry? + # if it's an automatic job retry we should process the main queue + if manual_retry? if queue.expired? abort! "The test run is too old and can't be retried" end @@ -671,9 +672,15 @@ def abort!(message, exit_status=1) exit! exit_status # exit! is required to avoid minitest at_exit callback end + def manual_retry? + # this env variable only exists on Buildkite so we should default to manual for backward compatibility + (retry? || queue.retrying?) && + ENV.fetch('BUILDKITE_RETRY_TYPE', 'manual') == 'manual' + end + def retry? - ENV["BUILDKITE_RETRY_COUNT"].to_i > 0 || - ENV["SEMAPHORE_PIPELINE_RERUN"] == "true" + ENV['BUILDKITE_RETRY_COUNT'].to_i > 0 || + ENV['SEMAPHORE_PIPELINE_RERUN'] == 'true' end end end