diff --git a/scripts/gha/integration_testing/ftl_gha_validator.py b/scripts/gha/integration_testing/ftl_gha_validator.py index 58119d2315..dfa6118ebb 100644 --- a/scripts/gha/integration_testing/ftl_gha_validator.py +++ b/scripts/gha/integration_testing/ftl_gha_validator.py @@ -79,7 +79,18 @@ def _gcs_list_dir(gcs_path): """Recursively returns a list of contents for a directory on GCS.""" args = [GSUTIL, "ls", "-r", gcs_path] logging.info("Listing GCS contents: %s", " ".join(args)) - result = subprocess.run(args=args, capture_output=True, text=True, check=True) + try: + result = subprocess.run(args=args, capture_output=True, text=True, check=True) + except subprocess.CalledProcessError as e: + # It's possible to have a CalledProcessError but still have gotten a file list. + # Check the stdout to see if we got lines that look GCS file paths, and ignore + # the error if so. + output = e.output.splitlines() + if len(output) > 1 and gcs_path in output[0]: + return output + else: + print("Error: %s" % e.stderr) + raise e return result.stdout.splitlines() @@ -88,7 +99,11 @@ def _gcs_read_file(gcs_path): """Extracts the contents of a file on GCS.""" args = [GSUTIL, "cat", gcs_path] logging.info("Reading GCS file: %s", " ".join(args)) - result = subprocess.run(args=args, capture_output=True, text=True, check=True) + try: + result = subprocess.run(args=args, capture_output=True, text=True, check=True) + except subprocess.CalledProcessError as e: + print("Error: %s" % e.stderr) + raise e return result.stdout