Skip to content

Commit

Permalink
Fix running build log for postsubmit jobs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Hitchman committed Oct 18, 2017
1 parent 27accbb commit d1fe2aa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions gubernator/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ external_services:
gcs_pull_prefix: istio-prow/pull
prow_url: prow.istio.io
kubernetes:
gcs_bucket: kubernetes-jenkins/
gcs_pull_prefix: kubernetes-jenkins/pr-logs/pull
prow_url: prow.k8s.io
jobs:
Expand Down
18 changes: 9 additions & 9 deletions gubernator/view_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,19 +215,17 @@ def get(self, prefix, job, build):
build_log = get_build_log(build_dir)

pr, pr_path, pr_digest, repo = None, None, None, None
external_config = get_pr_config(prefix, self.app.config)
external_config = get_build_config(prefix, self.app.config)
if external_config is not None:
pr, pr_path, pr_digest, repo = get_pr_info(prefix, self.app.config)
if '/pull/' in prefix:
pr, pr_path, pr_digest, repo = get_pr_info(prefix, self.app.config)
if want_build_log and not build_log:
build_log, build_log_src = get_running_build_log(job, build,
external_config["prow_url"])

# 'version' might be in either started or finished.
# prefer finished.
if finished and 'version' in finished:
version = finished['version']
else:
version = started and started.get('version')
version = finished and finished.get('version') or started and started.get('version')
commit = version and version.split('+')[-1]

issues = list(models.GHIssueDigest.find_xrefs(build_dir))
Expand All @@ -251,9 +249,11 @@ def get(self, prefix, job, build):
testgrid_query=testgrid_query))


def get_pr_config(prefix, config):
for item in config["external_services"].values():
if prefix.startswith(item["gcs_pull_prefix"]):
def get_build_config(prefix, config):
for item in config['external_services'].values():
if prefix.startswith(item['gcs_pull_prefix']):
return item
if 'gcs_bucket' in item and prefix.startswith(item['gcs_bucket']):
return item

def get_pr_info(prefix, config):
Expand Down

0 comments on commit d1fe2aa

Please sign in to comment.