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

Unified Diff: infra/bots/recipe_modules/infra/api.py

Issue 2444883002: Add infra recipe module, use for updating Go DEPS (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « infra/bots/recipe_modules/infra/__init__.py ('k') | infra/bots/recipe_modules/run/api.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: infra/bots/recipe_modules/infra/api.py
diff --git a/infra/bots/recipe_modules/infra/api.py b/infra/bots/recipe_modules/infra/api.py
new file mode 100644
index 0000000000000000000000000000000000000000..17d3729b87ea7be3647e678a0de578945090c22b
--- /dev/null
+++ b/infra/bots/recipe_modules/infra/api.py
@@ -0,0 +1,32 @@
+# Copyright 2016 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 recipe_engine import recipe_api
+
+
+INFRA_GO_PKG = 'go.skia.org/infra'
+UPDATE_GO_ATTEMPTS = 5
+
+
+class InfraApi(recipe_api.RecipeApi):
+ @property
+ def go_env(self):
+ return {'GOPATH': self.gopath}
+
+ @property
+ def gopath(self):
+ return self.m.vars.checkout_root.join('gopath')
+
+ def update_go_deps(self):
+ """Attempt to update go dependencies.
+
+ This fails flakily sometimes, so perform multiple attempts.
+ """
+ self.m.run.with_retry(
+ self.m.step,
+ 'update go pkgs',
+ UPDATE_GO_ATTEMPTS,
+ cmd=['go', 'get', '-u', '%s/...' % INFRA_GO_PKG],
+ env=self.go_env)
« no previous file with comments | « infra/bots/recipe_modules/infra/__init__.py ('k') | infra/bots/recipe_modules/run/api.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698