Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw a different Exception when failing to download Bazel at a given commit #1507

Merged
merged 1 commit into from
Dec 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions buildkite/bazelci.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,14 @@ class BuildkiteException(Exception):
pass


class BuildkiteInfraException(Exception):
"""
Raised whenever something goes wrong with the CI infra and we should immediately exit with an error.
"""

pass


class BinaryUploadRaceException(Exception):
"""
Raised when try_publish_binaries wasn't able to publish a set of binaries,
Expand Down Expand Up @@ -1604,13 +1612,11 @@ def download_bazel_nojdk_binary(dest_dir, platform):
return download_binary(dest_dir, platform, binary_name)


def download_binary_at_commit(
dest_dir, platform, bazel_git_commit, bazel_binary_url, bazel_binary_path
):
def download_binary_at_commit(bazel_git_commit, bazel_binary_url, bazel_binary_path):
try:
execute_command([gsutil_command(), "cp", bazel_binary_url, bazel_binary_path])
except subprocess.CalledProcessError as e:
raise BuildkiteException(
raise BuildkiteInfraException(
"Failed to download Bazel binary at %s, error message:\n%s" % (bazel_git_commit, str(e))
)
st = os.stat(bazel_binary_path)
Expand All @@ -1621,13 +1627,13 @@ def download_binary_at_commit(
def download_bazel_binary_at_commit(dest_dir, platform, bazel_git_commit):
url = bazelci_builds_gs_url(platform, bazel_git_commit)
path = os.path.join(dest_dir, "bazel.exe" if platform == "windows" else "bazel")
return download_binary_at_commit(dest_dir, platform, bazel_git_commit, url, path)
return download_binary_at_commit(bazel_git_commit, url, path)


def download_bazel_nojdk_binary_at_commit(dest_dir, platform, bazel_git_commit):
url = bazelci_builds_nojdk_gs_url(platform, bazel_git_commit)
path = os.path.join(dest_dir, "bazel_nojdk.exe" if platform == "windows" else "bazel_nojdk")
return download_binary_at_commit(dest_dir, platform, bazel_git_commit, url, path)
return download_binary_at_commit(bazel_git_commit, url, path)


def download_bazelci_agent(dest_dir, version):
Expand Down