diff options
-rw-r--r-- | infra/bots/gen_tasks.go | 14 | ||||
-rw-r--r-- | infra/bots/recipe_modules/git/__init__.py | 10 | ||||
-rw-r--r-- | infra/bots/recipe_modules/git/api.py | 18 | ||||
-rw-r--r-- | infra/bots/recipe_modules/git/examples/full.expected/test.json | 24 | ||||
-rw-r--r-- | infra/bots/recipe_modules/git/examples/full.py | 19 | ||||
-rw-r--r-- | infra/bots/recipes/bundle_recipes.expected/BundleRecipes.json | 12 | ||||
-rw-r--r-- | infra/bots/recipes/bundle_recipes.py | 22 | ||||
-rw-r--r-- | infra/bots/tasks.json | 12 | ||||
-rw-r--r-- | infra/config/recipes.cfg | 4 |
9 files changed, 122 insertions, 13 deletions
diff --git a/infra/bots/gen_tasks.go b/infra/bots/gen_tasks.go index b281a508c3..07e63ad579 100644 --- a/infra/bots/gen_tasks.go +++ b/infra/bots/gen_tasks.go @@ -62,6 +62,18 @@ var ( // Defines the structure of job names. jobNameSchema *JobNameSchema + // Git 2.13. + cipdGit1 = &specs.CipdPackage{ + Name: fmt.Sprintf("infra/git/${platform}"), + Path: "git", + Version: fmt.Sprintf("version:2.13.0.chromium9"), + } + cipdGit2 = &specs.CipdPackage{ + Name: fmt.Sprintf("infra/tools/git/${platform}"), + Path: "git", + Version: fmt.Sprintf("git_revision:a78b5f3658c0578a017db48df97d20ac09822bcd"), + } + // Flags. androidMapFile = flag.String("android_map", "", "JSON file containing a mapping of human-friendly Android device names to a pair of {device_type, device_os}.") builderNameSchemaFile = flag.String("builder_name_schema", "", "Path to the builder_name_schema.json file. If not specified, uses infra/bots/recipe_modules/builder_name_schema/builder_name_schema.json from this repo.") @@ -236,7 +248,7 @@ func swarmDimensions(parts map[string]string) []string { // bundleRecipes generates the task to bundle and isolate the recipes. func bundleRecipes(b *specs.TasksCfgBuilder) string { b.MustAddTask(BUNDLE_RECIPES_NAME, &specs.TaskSpec{ - CipdPackages: []*specs.CipdPackage{}, + CipdPackages: []*specs.CipdPackage{cipdGit1, cipdGit2}, Dimensions: linuxGceDimensions(), ExtraArgs: []string{ "--workdir", "../../..", "bundle_recipes", 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') diff --git a/infra/bots/recipes/bundle_recipes.expected/BundleRecipes.json b/infra/bots/recipes/bundle_recipes.expected/BundleRecipes.json index 0f7df741ef..1cf232b276 100644 --- a/infra/bots/recipes/bundle_recipes.expected/BundleRecipes.json +++ b/infra/bots/recipes/bundle_recipes.expected/BundleRecipes.json @@ -5,6 +5,9 @@ "init" ], "cwd": "[START_DIR]/skia", + "env": { + "PATH": "[START_DIR]/git:[START_DIR]/git/bin:<PATH>" + }, "infra_step": true, "name": "git init" }, @@ -15,6 +18,9 @@ "." ], "cwd": "[START_DIR]/skia", + "env": { + "PATH": "[START_DIR]/git:[START_DIR]/git/bin:<PATH>" + }, "infra_step": true, "name": "git add" }, @@ -26,6 +32,9 @@ "commit recipes" ], "cwd": "[START_DIR]/skia", + "env": { + "PATH": "[START_DIR]/git:[START_DIR]/git/bin:<PATH>" + }, "infra_step": true, "name": "git commit" }, @@ -38,6 +47,9 @@ "[SWARM_OUT_DIR]/recipe_bundle" ], "cwd": "[START_DIR]/skia", + "env": { + "PATH": "[START_DIR]/git:[START_DIR]/git/bin:<PATH>" + }, "infra_step": true, "name": "Bundle Recipes" }, diff --git a/infra/bots/recipes/bundle_recipes.py b/infra/bots/recipes/bundle_recipes.py index ef0eccb6cc..49310af55a 100644 --- a/infra/bots/recipes/bundle_recipes.py +++ b/infra/bots/recipes/bundle_recipes.py @@ -7,10 +7,10 @@ DEPS = [ + 'git', 'recipe_engine/context', 'recipe_engine/path', 'recipe_engine/properties', - 'recipe_engine/shutil', 'recipe_engine/step', ] @@ -19,15 +19,17 @@ def RunSteps(api): bundle_dir = api.properties['swarm_out_dir'] + '/recipe_bundle' skia_dir = api.path['start_dir'].join('skia') recipes_py = api.path['start_dir'].join('skia', 'infra', 'bots', 'recipes.py') - with api.context(cwd=skia_dir): - api.step('git init', infra_step=True, - cmd=['git', 'init']) - api.step('git add', infra_step=True, - cmd=['git', 'add', '.']) - api.step('git commit', infra_step=True, - cmd=['git', 'commit', '-m', 'commit recipes']) - api.step('Bundle Recipes', infra_step=True, - cmd=['python', recipes_py, 'bundle', '--destination', bundle_dir]) + with api.git.env(): + with api.context(cwd=skia_dir): + api.step('git init', infra_step=True, + cmd=['git', 'init']) + api.step('git add', infra_step=True, + cmd=['git', 'add', '.']) + api.step('git commit', infra_step=True, + cmd=['git', 'commit', '-m', 'commit recipes']) + api.step('Bundle Recipes', infra_step=True, + cmd=['python', recipes_py, 'bundle', + '--destination', bundle_dir]) def GenTests(api): diff --git a/infra/bots/tasks.json b/infra/bots/tasks.json index 2d214e11d9..5d22648785 100644 --- a/infra/bots/tasks.json +++ b/infra/bots/tasks.json @@ -4465,6 +4465,18 @@ "priority": 0.8 }, "Housekeeper-PerCommit-BundleRecipes": { + "cipd_packages": [ + { + "name": "infra/git/${platform}", + "path": "git", + "version": "version:2.13.0.chromium9" + }, + { + "name": "infra/tools/git/${platform}", + "path": "git", + "version": "git_revision:a78b5f3658c0578a017db48df97d20ac09822bcd" + } + ], "dimensions": [ "cpu:x86-64-avx2", "gpu:none", diff --git a/infra/config/recipes.cfg b/infra/config/recipes.cfg index 954845b743..5c3c1274e6 100644 --- a/infra/config/recipes.cfg +++ b/infra/config/recipes.cfg @@ -14,12 +14,12 @@ "deps": { "depot_tools": { "branch": "master", - "revision": "be812619bdaa990418316ca1cefac5de8bbd3adb", + "revision": "1a10a2e9f341717cde57254232407f8ac5ed4a8b", "url": "https://chromium.googlesource.com/chromium/tools/depot_tools.git" }, "recipe_engine": { "branch": "master", - "revision": "a64a4d4ad8e4844cb81868a2b24df4d836d5caca", + "revision": "ddd199058ea23f965a1a6b276d76cf5c3723baaf", "url": "https://chromium.googlesource.com/external/github.com/luci/recipes-py.git" } }, |