summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimran Basi <sbasi@chromium.org>2014-05-20 14:40:16 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-05-29 02:14:54 +0000
commit2b1b23dcb333b4faeb3a3a04ef8e892188bb21c9 (patch)
tree791c8f231e0541ac5d378a495eb3e1cc01ba7319
parent567b7e6e4e78dd8139d295433cf8166be34baf41 (diff)
downloadchromite-2b1b23dcb333b4faeb3a3a04ef8e892188bb21c9.tar.gz
Copy LATEST markers to extra upload archives.
Currently we don't upload the LATEST markers. This change looks up the board for each builder_run in the report stage and also uploads the LATEST marker to the extra archives if there are any. BUG=chromium:375354 TEST=Rambi-paladin trybot run. sandybridge-ivybridge-release-group trybot run. report_stages_unittest. Change-Id: I2863561b8e312aa5499fce9501c5215db0732f0b Reviewed-on: https://chromium-review.googlesource.com/201233 Tested-by: Simran Basi <sbasi@chromium.org> Reviewed-by: Don Garrett <dgarrett@chromium.org> Commit-Queue: Simran Basi <sbasi@chromium.org>
-rw-r--r--cbuildbot/cbuildbot_archive.py20
-rw-r--r--cbuildbot/stages/generic_stages.py9
-rw-r--r--cbuildbot/stages/report_stages.py12
-rwxr-xr-xcbuildbot/stages/report_stages_unittest.py2
4 files changed, 29 insertions, 14 deletions
diff --git a/cbuildbot/cbuildbot_archive.py b/cbuildbot/cbuildbot_archive.py
index 6d42b36b5..d251c0a22 100644
--- a/cbuildbot/cbuildbot_archive.py
+++ b/cbuildbot/cbuildbot_archive.py
@@ -155,13 +155,16 @@ class Archive(object):
osutils.SafeMakedirs(self.archive_path)
- def UpdateLatestMarkers(self, manifest_branch, debug):
+ def UpdateLatestMarkers(self, manifest_branch, debug, upload_urls=None):
"""Update the LATEST markers in GS archive area.
Args:
manifest_branch: The name of the branch in the manifest for this run.
debug: Boolean debug value for this run.
+ upload_urls: Google storage urls to upload the Latest Markers to.
"""
+ if not upload_urls:
+ upload_urls = [self.upload_url]
# self.version will be one of these forms, shown through examples:
# R35-1234.5.6 or R35-1234.5.6-b123. In either case, we want "1234.5.6".
version_marker = self.version.split('-')[1]
@@ -169,10 +172,11 @@ class Archive(object):
filenames = ('LATEST-%s' % manifest_branch,
'LATEST-%s' % version_marker)
base_archive_path = os.path.dirname(self.archive_path)
- base_upload_url = os.path.dirname(self.upload_url)
- for filename in filenames:
- latest_path = os.path.join(base_archive_path, filename)
- osutils.WriteFile(latest_path, self.version, mode='w')
- commands.UploadArchivedFile(
- base_archive_path, [base_upload_url], filename,
- debug, acl=self.upload_acl)
+ base_upload_urls = [os.path.dirname(url) for url in upload_urls]
+ for base_upload_url in base_upload_urls:
+ for filename in filenames:
+ latest_path = os.path.join(base_archive_path, filename)
+ osutils.WriteFile(latest_path, self.version, mode='w')
+ commands.UploadArchivedFile(
+ base_archive_path, [base_upload_url], filename,
+ debug, acl=self.upload_acl)
diff --git a/cbuildbot/stages/generic_stages.py b/cbuildbot/stages/generic_stages.py
index 72153c898..9b2adcf06 100644
--- a/cbuildbot/stages/generic_stages.py
+++ b/cbuildbot/stages/generic_stages.py
@@ -677,17 +677,20 @@ class ArchivingStageMixin(object):
return True
return False
- def _GetUploadUrls(self, filename):
+ def _GetUploadUrls(self, filename, board=None):
"""Returns a list of all urls for which to upload filename to.
Args:
filename: The filename of the file we want to upload.
+ board: Board whose overlay to search for the artifacts.json file.
+ If none, self._current_board is used if it exists.
"""
urls = [self.upload_url]
if (not self._IsInUploadBlacklist(filename) and
- hasattr(self, '_current_board')):
+ (hasattr(self, '_current_board') or board)):
+ board = board if board else self._current_board
custom_artifacts_file = portage_utilities.ReadOverlayFile(
- 'scripts/artifacts.json', board=self._current_board)
+ 'scripts/artifacts.json', board=board)
if custom_artifacts_file is not None:
json_file = json.loads(custom_artifacts_file)
for url in json_file.get('extra_upload_urls', []):
diff --git a/cbuildbot/stages/report_stages.py b/cbuildbot/stages/report_stages.py
index 5f32f8a5d..45c7fd55f 100644
--- a/cbuildbot/stages/report_stages.py
+++ b/cbuildbot/stages/report_stages.py
@@ -328,11 +328,19 @@ class ReportStage(generic_stages.BuilderStage,
run_archive_urls = self._UploadArchiveIndex(builder_run)
if run_archive_urls:
archive_urls.update(run_archive_urls)
-
# Also update the LATEST files, since this run did archive something.
+
+ # Check if the builder_run is tied to any boards and if so get all
+ # upload urls.
+ if builder_run.config['boards']:
+ upload_urls = self._GetUploadUrls(
+ 'LATEST-*', board=builder_run.config['boards'][0])
+ else:
+ upload_urls = [self.upload_url]
archive = builder_run.GetArchive()
archive.UpdateLatestMarkers(builder_run.manifest_branch,
- builder_run.debug)
+ builder_run.debug,
+ upload_urls=upload_urls)
version = getattr(self._run.attrs, 'release_tag', '')
results_lib.Results.Report(sys.stdout, archive_urls=archive_urls,
diff --git a/cbuildbot/stages/report_stages_unittest.py b/cbuildbot/stages/report_stages_unittest.py
index 5cf563171..ad3290874 100755
--- a/cbuildbot/stages/report_stages_unittest.py
+++ b/cbuildbot/stages/report_stages_unittest.py
@@ -35,7 +35,7 @@ class ReportStageTest(generic_stages_unittest.AbstractStageTest):
RELEASE_TAG = ''
def setUp(self):
- for cmd in ((osutils, 'ReadFile'), (osutils, 'WriteFile'),
+ for cmd in ((osutils, 'WriteFile'),
(commands, 'UploadArchivedFile'),
(alerts, 'SendEmail')):
self.StartPatcher(mock.patch.object(*cmd, autospec=True))