fix: read from local file (#2474)

* fix: read from local file

* fix: GCS file
This commit is contained in:
Andrew Ferlitsch
2023-11-08 21:46:03 +00:00
committed by GitHub
parent b4f3601262
commit 42914ffba6
+10 -2
View File
@@ -5,14 +5,22 @@ Cloud Storage location: gs://cloud-build-notebooks-presubmit/build_results/
'''
import argparse
import json
from util import download_file
parser = argparse.ArgumentParser()
parser.add_argument('--file', dest='file',
default='build.json', type=str, help='build results file')
import json
args = parser.parse_args()
with open('build.json', 'r') as f:
if args.file.startswith("gs://"):
path = args.file[5:]
bucket = path.split('/')[0]
file = path[len(bucket)+1:]
download_file(bucket, file, "build.json")
args.file = "build.json"
with open(args.file, 'r') as f:
results = json.load(f)
for item in results.items():