diff options
author | Prathmesh Prabhu <pprabhu@chromium.org> | 2015-07-18 00:16:48 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-07-20 20:49:15 +0000 |
commit | f3e548087626a4888052060bef511e651dc1297f (patch) | |
tree | 72567f497b714f86af2d4c29555df47f4aec4454 /cbuildbot/stages/report_stages.py | |
parent | beedf18a1ff72ac81cfaf2f52eadd299b2fa80b9 (diff) | |
download | chromite-f3e548087626a4888052060bef511e651dc1297f.tar.gz |
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 <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
Reviewed-by: Aviv Keshet <akeshet@chromium.org>
Commit-Queue: Prathmesh Prabhu <pprabhu@chromium.org>
Diffstat (limited to 'cbuildbot/stages/report_stages.py')
-rw-r--r-- | cbuildbot/stages/report_stages.py | 14 |
1 files changed, 12 insertions, 2 deletions
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, |