Catch CalledProcessError for get_last_green_commit
Change-Id: I04651cfcbfc8d4f935e4c1178b4001210f48c022
diff --git a/buildkite/bazelci.py b/buildkite/bazelci.py
index 797dc92..fa2ea47 100644
--- a/buildkite/bazelci.py
+++ b/buildkite/bazelci.py
@@ -1292,7 +1292,10 @@
def get_last_green_commit(git_repository, project_name_slug):
last_green_commit_url = bazelci_last_green_commit_url(git_repository, project_name_slug)
- return subprocess.check_output([gsutil_command(), "cat", last_green_commit_url], env=os.environ).decode("utf-8").strip()
+ try:
+ return subprocess.check_output([gsutil_command(), "cat", last_green_commit_url], env=os.environ).decode("utf-8").strip()
+ except subprocess.CalledProcessError:
+ return None
def latest_generation_and_build_number():