From f3e548087626a4888052060bef511e651dc1297f Mon Sep 17 00:00:00 2001 From: Prathmesh Prabhu Date: Sat, 18 Jul 2015 00:16:48 -0700 Subject: report_stage: Be robust to sync stage failures. Sync stage failures can cause version information to not be populated correctly. Before this CL, ReportStage blows up when trying to archive the results. This CL makes ReportStage robust to missing version info. BUG=chromium:481092 TEST=unittests, trybot with injected exception in SyncStage. Change-Id: Ifdfd7cbff35733b6a1c4123e10bee5f56394aaa4 Reviewed-on: https://chromium-review.googlesource.com/286636 Trybot-Ready: Prathmesh Prabhu Tested-by: Prathmesh Prabhu Reviewed-by: Aviv Keshet Commit-Queue: Prathmesh Prabhu --- cbuildbot/stages/report_stages.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'cbuildbot/stages/report_stages.py') diff --git a/cbuildbot/stages/report_stages.py b/cbuildbot/stages/report_stages.py index bd4843e1f..518cf1c93 100644 --- a/cbuildbot/stages/report_stages.py +++ b/cbuildbot/stages/report_stages.py @@ -10,6 +10,7 @@ from __future__ import print_function import os import sys +from chromite.cbuildbot import cbuildbot_run from chromite.cbuildbot import commands from chromite.cbuildbot import constants from chromite.cbuildbot import failures_lib @@ -589,8 +590,17 @@ class ReportStage(generic_stages.BuilderStage, # ArchiveResults() depends the existence of this attr. self._run.attrs.release_tag = None - archive_urls = self.ArchiveResults(final_status) - metadata_url = os.path.join(self.upload_url, constants.METADATA_JSON) + # Some operations can only be performed if a valid version is available. + try: + self._run.GetVersionInfo() + archive_urls = self.ArchiveResults(final_status) + metadata_url = os.path.join(self.upload_url, constants.METADATA_JSON) + except cbuildbot_run.VersionNotSetError: + logging.error('A valid version was never set for this run. ' + 'Can not archive results.') + archive_urls = '' + metadata_url = '' + results_lib.Results.Report( sys.stdout, archive_urls=archive_urls, -- cgit v1.2.3