Loading tools/ci-build/acquire-build-image +13 −8 Original line number Diff line number Diff line Loading @@ -69,6 +69,13 @@ class Context: return Context(start_path, script_path, tools_path, user_id, image_tag, allow_local_build, github_actions) def output_contains_any(stdout, stderr, messages): for message in messages: if message in stdout or message in stderr: return True return False # Mockable shell commands class Shell: # Returns the platform that this script is running on Loading @@ -93,18 +100,16 @@ class Shell: print(stderr) print("-------------------") not_found_message = "not found: manifest unknown" throttle_message = "toomanyrequests: Rate exceeded" not_found_messages = ["not found: manifest unknown"] throttle_messages = ["toomanyrequests: Rate exceeded", "toomanyrequests: Data limit exceeded"] retryable_messages = ["net/http: TLS handshake timeout"] if status == 0: return DockerPullResult.SUCCESS elif throttle_message in stdout or throttle_message in stderr: elif output_contains_any(stdout, stderr, throttle_messages): return DockerPullResult.ERROR_THROTTLED elif not_found_message in stdout or not_found_message in stderr: elif output_contains_any(stdout, stderr, not_found_messages): return DockerPullResult.NOT_FOUND else: for message in retryable_messages: if message in stdout or message in stderr: elif output_contains_any(stdout, stderr, retryable_messages): return DockerPullResult.RETRYABLE_ERROR return DockerPullResult.UNKNOWN_ERROR Loading Loading
tools/ci-build/acquire-build-image +13 −8 Original line number Diff line number Diff line Loading @@ -69,6 +69,13 @@ class Context: return Context(start_path, script_path, tools_path, user_id, image_tag, allow_local_build, github_actions) def output_contains_any(stdout, stderr, messages): for message in messages: if message in stdout or message in stderr: return True return False # Mockable shell commands class Shell: # Returns the platform that this script is running on Loading @@ -93,18 +100,16 @@ class Shell: print(stderr) print("-------------------") not_found_message = "not found: manifest unknown" throttle_message = "toomanyrequests: Rate exceeded" not_found_messages = ["not found: manifest unknown"] throttle_messages = ["toomanyrequests: Rate exceeded", "toomanyrequests: Data limit exceeded"] retryable_messages = ["net/http: TLS handshake timeout"] if status == 0: return DockerPullResult.SUCCESS elif throttle_message in stdout or throttle_message in stderr: elif output_contains_any(stdout, stderr, throttle_messages): return DockerPullResult.ERROR_THROTTLED elif not_found_message in stdout or not_found_message in stderr: elif output_contains_any(stdout, stderr, not_found_messages): return DockerPullResult.NOT_FOUND else: for message in retryable_messages: if message in stdout or message in stderr: elif output_contains_any(stdout, stderr, retryable_messages): return DockerPullResult.RETRYABLE_ERROR return DockerPullResult.UNKNOWN_ERROR Loading