From e9d2039a0ff329f32fc78031fff9c81edac148e4 Mon Sep 17 00:00:00 2001 From: Oliver Chang Date: Tue, 14 Mar 2017 14:21:56 -0700 Subject: [PATCH] [infra] gcb: Build our own logs link. The one returned by the API uses a text filter on the build id, which is slow. --- infra/gcb/build.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/infra/gcb/build.py b/infra/gcb/build.py index 64c0ecbd9..e6523cc61 100755 --- a/infra/gcb/build.py +++ b/infra/gcb/build.py @@ -152,6 +152,12 @@ def get_build_steps(project_yaml): return build_steps +def get_logs_url(build_id): + URL_FORMAT = ('https://console.developers.google.com/logs/viewer?' + 'resource=build%2Fbuild_id%2F{0}&project=clusterfuzz-external') + return URL_FORMAT.format(build_id) + + def main(): if len(sys.argv) != 2: usage() @@ -180,10 +186,11 @@ def main(): credentials = GoogleCredentials.get_application_default() cloudbuild = build('cloudbuild', 'v1', credentials=credentials) - build_info = cloudbuild.projects().builds().create(projectId='clusterfuzz-external', body=build_body).execute() + build_info = cloudbuild.projects().builds().create( + projectId='clusterfuzz-external', body=build_body).execute() build_id = build_info['metadata']['build']['id'] - print >>sys.stderr, 'Logs:', build_info['metadata']['build']['logUrl'] + print >>sys.stderr, 'Logs:', get_logs_url(build_id) print build_id