diff --git a/release/ray_release/scripts/custom_image_build_and_test_init.py b/release/ray_release/scripts/custom_image_build_and_test_init.py index 01e5ca974cef..7cc0bc67fdb9 100644 --- a/release/ray_release/scripts/custom_image_build_and_test_init.py +++ b/release/ray_release/scripts/custom_image_build_and_test_init.py @@ -154,6 +154,12 @@ def _split_into_batches( type=str, help="Output file for RAYCI_SELECT (comma-separated base-image publish step keys).", ) +@click.option( + "--selection-block-threshold", + type=int, + default=0, + help="Number of tests to trigger before asking for confirmation when manually triggered; set to 0 to disable blocking regardless of the number of tests.", +) def main( test_collection_file: Tuple[str], run_jailed_tests: bool = False, @@ -166,6 +172,7 @@ def main( test_jobs_output_file: str = None, max_jobs_per_upload: int = DEFAULT_MAX_JOBS_PER_UPLOAD, rayci_select_output_file: str = None, + selection_block_threshold: int = 0, ): global_config_file = os.path.join( os.path.dirname(__file__), "..", "configs", global_config @@ -249,8 +256,11 @@ def main( # If the build is manually triggered and there are more than 5 tests # Ask user to confirm before launching the tests. block_step = None - if test_filters and len(tests) >= 5 and os.environ.get("AUTOMATIC", "") != "1": - block_step = generate_block_step(len(tests)) + + is_automatic = os.environ.get("AUTOMATIC", "") == "1" + if not is_automatic and test_filters and selection_block_threshold > 0: + if len(tests) >= selection_block_threshold: + block_step = generate_block_step(len(tests)) steps = get_step_for_test_group( grouped_tests, diff --git a/release/ray_release/tests/test_custom_image_build_and_test_init.py b/release/ray_release/tests/test_custom_image_build_and_test_init.py index af831fc9d91c..98f4d6f6510a 100644 --- a/release/ray_release/tests/test_custom_image_build_and_test_init.py +++ b/release/ray_release/tests/test_custom_image_build_and_test_init.py @@ -141,6 +141,8 @@ def test_custom_image_build_and_test_init_with_block_step( test_jobs_output_file, "--rayci-select-output-file", rayci_select_output_file, + "--selection-block-threshold", + "5", ], catch_exceptions=False, )