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) |