Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2717)

Unified Diff: appengine/findit/waterfall/pull_changelog_pipeline.py

Issue 838003004: [Findit] Add three sub-pipelines to analyze build failure. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Just rebase. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: appengine/findit/waterfall/pull_changelog_pipeline.py
diff --git a/appengine/findit/waterfall/pull_changelog_pipeline.py b/appengine/findit/waterfall/pull_changelog_pipeline.py
new file mode 100644
index 0000000000000000000000000000000000000000..500c12533c6868135b1b2f87101b3b24d1a0df76
--- /dev/null
+++ b/appengine/findit/waterfall/pull_changelog_pipeline.py
@@ -0,0 +1,43 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from pipeline_utils.appengine_third_party_pipeline_src_pipeline import pipeline
+
+from common.git_repository import GitRepository
+from common.http_client_appengine import HttpClientAppengine as HttpClient
+from waterfall.base_pipeline import BasePipeline
+
+
+class PullChangelogPipeline(BasePipeline):
+ """A pipeline to pull change log of CLs."""
+
+ # TODO: for files in dependencies(blink, v8, skia, etc), use blame first.
+ GIT_REPO = GitRepository(
+ 'https://chromium.googlesource.com/chromium/src', HttpClient())
+
+ # Arguments number differs from overridden method - pylint: disable=W0221
+ def run(self, failure_info):
+ """
+ Args:
+ failure_info (dict): Output of pipeline DetectFirstFailurePipeline.run().
+
+ Returns:
+ A dict with the following form:
+ {
+ 'git_hash_revision1': common.change_log.ChangeLog.ToJson(),
+ ...
+ }
+ """
+ change_logs = {}
+
+ for build in failure_info['builds'].values():
+ for revision in build['blame_list']:
+ change_log = self.GIT_REPO.GetChangeLog(revision)
+ if not change_log: # pragma: no cover
+ raise pipeline.Retry('Failed to get change log for %s' % revision)
+
+ # TODO: save in datastore?
+ change_logs[revision] = change_log.ToJson()
+
+ return change_logs

Powered by Google App Engine
This is Rietveld 408576698