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

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: . 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..98d21549123cc0f0950e45fe90df41038cfb82c0
--- /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.
+
+ Input:
+ It is output of pipeline DetectFirstFailurePipeline.
+
+ Output:
+ It is a json like below:
+ {
+ 'git_hash_revision1': model.change_log.ChangeLog.ToJson(),
+ ...
+ }
+ """
+
+ # 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):
+ 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