Unverified Commit c04c6ab4 authored by John DiSanti's avatar John DiSanti Committed by GitHub
Browse files

Add `Data limit exceeded` to build image throttle messages (#2260)

parent 861d1d89
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -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
@@ -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