aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra/bots/recipe_modules
diff options
context:
space:
mode:
authorGravatar Eric Boren <borenet@google.com>2017-06-06 08:27:09 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-06 12:45:11 +0000
commitf4a5fc7af06e71d03b967416fa6a11e59184e62f (patch)
tree6695531fd7288ba73a6af6151acb48e54475ce7d /infra/bots/recipe_modules
parent8e200787b769ba9ee0bd4bd37d27ded1fafc06e6 (diff)
Use chrome-infra Git CIPD package
Add Git recipe module to easily use this version of Git anywhere. This fixes recipe bundling and unblocks the recipe roll. Bug: skia: Change-Id: Ib4d1361b7a52676e1992025b29e630ea3ada173b Reviewed-on: https://skia-review.googlesource.com/18833 Reviewed-by: Ravi Mistry <rmistry@google.com> Commit-Queue: Eric Boren <borenet@google.com>
Diffstat (limited to 'infra/bots/recipe_modules')
-rw-r--r--infra/bots/recipe_modules/git/__init__.py10
-rw-r--r--infra/bots/recipe_modules/git/api.py18
-rw-r--r--infra/bots/recipe_modules/git/examples/full.expected/test.json24
-rw-r--r--infra/bots/recipe_modules/git/examples/full.py19
4 files changed, 71 insertions, 0 deletions
diff --git a/infra/bots/recipe_modules/git/__init__.py b/infra/bots/recipe_modules/git/__init__.py
new file mode 100644
index 0000000000..abc3791170
--- /dev/null
+++ b/infra/bots/recipe_modules/git/__init__.py
@@ -0,0 +1,10 @@
+# Copyright 2017 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.
+
+
+DEPS = [
+ 'env',
+ 'recipe_engine/path',
+]
+
diff --git a/infra/bots/recipe_modules/git/api.py b/infra/bots/recipe_modules/git/api.py
new file mode 100644
index 0000000000..629937dfee
--- /dev/null
+++ b/infra/bots/recipe_modules/git/api.py
@@ -0,0 +1,18 @@
+# Copyright 2017 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
+
+
+class GitApi(recipe_api.RecipeApi):
+ def env(self):
+ """Add Git to PATH
+
+ Requires the infra/git and infra/tools/git CIPD packages to be installed
+ in the 'git' relative path.
+ """
+ git_dir = self.m.path['start_dir'].join('git')
+ git_bin = git_dir.join('bin')
+ return self.m.env({'PATH': '%s:%s:%%(PATH)s' % (git_dir, git_bin)})
diff --git a/infra/bots/recipe_modules/git/examples/full.expected/test.json b/infra/bots/recipe_modules/git/examples/full.expected/test.json
new file mode 100644
index 0000000000..2f5fa0ef13
--- /dev/null
+++ b/infra/bots/recipe_modules/git/examples/full.expected/test.json
@@ -0,0 +1,24 @@
+[
+ {
+ "cmd": [
+ "git",
+ "status"
+ ],
+ "name": "1"
+ },
+ {
+ "cmd": [
+ "git",
+ "status"
+ ],
+ "env": {
+ "PATH": "[START_DIR]/git:[START_DIR]/git/bin:<PATH>"
+ },
+ "name": "2"
+ },
+ {
+ "name": "$result",
+ "recipe_result": null,
+ "status_code": 0
+ }
+] \ No newline at end of file
diff --git a/infra/bots/recipe_modules/git/examples/full.py b/infra/bots/recipe_modules/git/examples/full.py
new file mode 100644
index 0000000000..a24d903cd5
--- /dev/null
+++ b/infra/bots/recipe_modules/git/examples/full.py
@@ -0,0 +1,19 @@
+# Copyright 2017 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.
+
+
+DEPS = [
+ 'git',
+ 'recipe_engine/step',
+]
+
+
+def RunSteps(api):
+ api.step('1', cmd=['git', 'status'])
+ with api.git.env():
+ api.step('2', cmd=['git', 'status'])
+
+
+def GenTests(api):
+ yield api.test('test')