[infra] Fix InfraTests recipe for other repos which use it
Change-Id: I7cd2163d316ed3b4575c7d3d05f6704c13cc46a5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/374258
Reviewed-by: Weston Tracey <westont@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
diff --git a/infra/bots/README.recipes.md b/infra/bots/README.recipes.md
index 4e1f943..d731e30 100644
--- a/infra/bots/README.recipes.md
+++ b/infra/bots/README.recipes.md
@@ -360,7 +360,9 @@
[DEPS](/infra/bots/recipes/infra.py#9): [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/step][recipe_engine/recipe_modules/step], [infra](#recipe_modules-infra), [vars](#recipe_modules-vars)
-— **def [RunSteps](/infra/bots/recipes/infra.py#19)(api):**
+— **def [RunSteps](/infra/bots/recipes/infra.py#27)(api):**
+
+— **def [git\_init](/infra/bots/recipes/infra.py#19)(api, repo_root, env):**
### *recipes* / [infra:examples/full](/infra/bots/recipe_modules/infra/examples/full.py)
[DEPS](/infra/bots/recipe_modules/infra/examples/full.py#9): [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/file][recipe_engine/recipe_modules/file], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/python][recipe_engine/recipe_modules/python], [recipe\_engine/step][recipe_engine/recipe_modules/step], [infra](#recipe_modules-infra), [run](#recipe_modules-run), [vars](#recipe_modules-vars)
diff --git a/infra/bots/recipes/infra.expected/infra_tests_lottie_ci.json b/infra/bots/recipes/infra.expected/infra_tests_lottie_ci.json
new file mode 100644
index 0000000..32992c8
--- /dev/null
+++ b/infra/bots/recipes/infra.expected/infra_tests_lottie_ci.json
@@ -0,0 +1,119 @@
+[
+ {
+ "cmd": [
+ "git",
+ "init"
+ ],
+ "cwd": "[START_DIR]/lottie-ci",
+ "env": {
+ "CHROME_HEADLESS": "1",
+ "GOCACHE": "[START_DIR]/cache/go_cache",
+ "GOPATH": "[START_DIR]/cache/gopath",
+ "GOROOT": "[START_DIR]/go/go",
+ "PATH": "[START_DIR]/go/go/bin:[START_DIR]/cache/gopath/bin:<PATH>:RECIPE_REPO[depot_tools]"
+ },
+ "name": "git init"
+ },
+ {
+ "cmd": [
+ "git",
+ "add",
+ "."
+ ],
+ "cwd": "[START_DIR]/lottie-ci",
+ "env": {
+ "CHROME_HEADLESS": "1",
+ "GOCACHE": "[START_DIR]/cache/go_cache",
+ "GOPATH": "[START_DIR]/cache/gopath",
+ "GOROOT": "[START_DIR]/go/go",
+ "PATH": "[START_DIR]/go/go/bin:[START_DIR]/cache/gopath/bin:<PATH>:RECIPE_REPO[depot_tools]"
+ },
+ "name": "git add ."
+ },
+ {
+ "cmd": [
+ "git",
+ "commit",
+ "-a",
+ "-m",
+ "initial commit"
+ ],
+ "cwd": "[START_DIR]/lottie-ci",
+ "env": {
+ "CHROME_HEADLESS": "1",
+ "GOCACHE": "[START_DIR]/cache/go_cache",
+ "GOPATH": "[START_DIR]/cache/gopath",
+ "GOROOT": "[START_DIR]/go/go",
+ "PATH": "[START_DIR]/go/go/bin:[START_DIR]/cache/gopath/bin:<PATH>:RECIPE_REPO[depot_tools]"
+ },
+ "name": "git commit"
+ },
+ {
+ "cmd": [
+ "git",
+ "init"
+ ],
+ "cwd": "[START_DIR]/skia",
+ "env": {
+ "CHROME_HEADLESS": "1",
+ "GOCACHE": "[START_DIR]/cache/go_cache",
+ "GOPATH": "[START_DIR]/cache/gopath",
+ "GOROOT": "[START_DIR]/go/go",
+ "PATH": "[START_DIR]/go/go/bin:[START_DIR]/cache/gopath/bin:<PATH>:RECIPE_REPO[depot_tools]"
+ },
+ "name": "git init (2)"
+ },
+ {
+ "cmd": [
+ "git",
+ "add",
+ "."
+ ],
+ "cwd": "[START_DIR]/skia",
+ "env": {
+ "CHROME_HEADLESS": "1",
+ "GOCACHE": "[START_DIR]/cache/go_cache",
+ "GOPATH": "[START_DIR]/cache/gopath",
+ "GOROOT": "[START_DIR]/go/go",
+ "PATH": "[START_DIR]/go/go/bin:[START_DIR]/cache/gopath/bin:<PATH>:RECIPE_REPO[depot_tools]"
+ },
+ "name": "git add . (2)"
+ },
+ {
+ "cmd": [
+ "git",
+ "commit",
+ "-a",
+ "-m",
+ "initial commit"
+ ],
+ "cwd": "[START_DIR]/skia",
+ "env": {
+ "CHROME_HEADLESS": "1",
+ "GOCACHE": "[START_DIR]/cache/go_cache",
+ "GOPATH": "[START_DIR]/cache/gopath",
+ "GOROOT": "[START_DIR]/go/go",
+ "PATH": "[START_DIR]/go/go/bin:[START_DIR]/cache/gopath/bin:<PATH>:RECIPE_REPO[depot_tools]"
+ },
+ "name": "git commit (2)"
+ },
+ {
+ "cmd": [
+ "python",
+ "-u",
+ "[START_DIR]/lottie-ci/infra/bots/infra_tests.py"
+ ],
+ "cwd": "[START_DIR]/lottie-ci",
+ "env": {
+ "CHROME_HEADLESS": "1",
+ "GOCACHE": "[START_DIR]/cache/go_cache",
+ "GOPATH": "[START_DIR]/cache/gopath",
+ "GOROOT": "[START_DIR]/go/go",
+ "PATH": "[START_DIR]/go/go/bin:[START_DIR]/cache/gopath/bin:<PATH>:RECIPE_REPO[depot_tools]"
+ },
+ "name": "infra_tests"
+ },
+ {
+ "name": "$result"
+ }
+]
\ No newline at end of file
diff --git a/infra/bots/recipes/infra.py b/infra/bots/recipes/infra.py
index cfed268..985e0d1 100644
--- a/infra/bots/recipes/infra.py
+++ b/infra/bots/recipes/infra.py
@@ -16,6 +16,14 @@
]
+def git_init(api, repo_root, env):
+ with api.context(cwd=repo_root, env=env):
+ # Some tests assume that they're being run inside a git repo.
+ api.step('git init', cmd=['git', 'init'])
+ api.step('git add .', cmd=['git', 'add', '.'])
+ api.step('git commit', cmd=['git', 'commit', '-a', '-m', 'initial commit'])
+
+
def RunSteps(api):
api.vars.setup()
@@ -38,12 +46,11 @@
else:
env[k] = v
- with api.context(cwd=repo_root, env=env):
- # Some tests assume that they're being run inside a git repo.
- api.step('git init', cmd=['git', 'init'])
- api.step('git add .', cmd=['git', 'add', '.'])
- api.step('git commit', cmd=['git', 'commit', '-a', '-m', 'initial commit'])
+ git_init(api, repo_root, env)
+ if repo_name != 'skia':
+ git_init(api, api.path['start_dir'].join('skia'), env)
+ with api.context(cwd=repo_root, env=env):
# Unfortunately, the recipe tests are flaky due to file removal on Windows.
# Run multiple attempts.
last_exc = None
@@ -64,3 +71,10 @@
path_config='kitchen',
swarm_out_dir='[SWARM_OUT_DIR]')
)
+ yield (
+ api.test('infra_tests_lottie_ci') +
+ api.properties(buildername='Housekeeper-PerCommit-InfraTests_Linux',
+ repository='https://skia.googlesource.com/lottie-ci.git',
+ path_config='kitchen',
+ swarm_out_dir='[SWARM_OUT_DIR]')
+ )