Fix how checkouts work.
Use new code to handle this written for another project.
Also roll dependencies.
Change-Id: I0f9a0cdd474091906584c960f8dd8e65dfebccda
diff --git a/infra/config/recipes.cfg b/infra/config/recipes.cfg
index f4db2f3..525ccb3 100644
--- a/infra/config/recipes.cfg
+++ b/infra/config/recipes.cfg
@@ -17,12 +17,12 @@
"deps": {
"recipe_engine": {
"branch": "master",
- "revision": "5591fe66be52b94aab70120f5401343521aaa4cc",
+ "revision": "1cbfca1cec9aedcd01cfe190a1569d2f42c8912b",
"url": "https://chromium.googlesource.com/infra/luci/recipes-py"
},
"fuchsia": {
"branch": "master",
- "revision": "088011636ba55297f63f97c9fd840294a69db8b4",
+ "revision": "8e5b791f4606887553df86ad70889636917f2a7f",
"url": "https://fuchsia.googlesource.com/infra/recipes"
}
},
diff --git a/recipe_modules/checkout/api.py b/recipe_modules/checkout/api.py
index bd77166..270a418 100644
--- a/recipe_modules/checkout/api.py
+++ b/recipe_modules/checkout/api.py
@@ -37,31 +37,22 @@
remote (str): URL of git repository
"""
+ self._root = self.m.path['start_dir'].join('checkout')
+
with self.m.step.nest('checkout'):
with self.m.context(infra_steps=True):
- self.m.build_input_resolver.resolve(remote)
- commit = self.m.buildbucket.build.input.gitiles_commit
+ bb_input = self.m.buildbucket.build.input
- self._root = self.m.path['start_dir'].join('checkout')
+ if bb_input.gerrit_changes:
+ self.m.git.checkout_cl(bb_input.gerrit_changes[0], path=self._root)
+ elif bb_input.gitiles_commit.project:
+ self.m.git.checkout_commit(bb_input.gitiles_commit, path=self._root)
+ else: # pragma: no cover
+ raise api.step.InfraFailure('no commit or CL specified')
- self.m.git.checkout(
- url='https://{}/{}'.format(commit.host, commit.project),
- ref=commit.id,
- path=self._root,
- )
-
- query_host = 'https://{}'.format(commit.host).replace(
- '.googlesource.com', '-review.googlesource.com')
- details = self.m.gerrit.change_details(
- 'get change details',
- change_id=commit.id,
- gerrit_host=query_host,
- test_data=self.m.json.test_api.output({'branch': 'master'}))
-
- # Rebase is deliberately not under infra_steps=True so rebase failures
- # are not presented as infra failures.
- with self.m.context(cwd=self._root):
- self.m.git.rebase('origin/{}'.format(details['branch']))
+ with self.m.context(cwd=self._root):
+ self.m.step('git log',
+ ['git', '--no-pager', 'log', '--oneline', 'HEAD~10..'])
@property
def root(self):
diff --git a/recipe_modules/checkout/test_api.py b/recipe_modules/checkout/test_api.py
index e37f17f..5213168 100644
--- a/recipe_modules/checkout/test_api.py
+++ b/recipe_modules/checkout/test_api.py
@@ -15,10 +15,14 @@
from recipe_engine import recipe_test_api
+REPO = 'https://pigweed.googlesource.com/pigweed/pigweed'
+
class CheckoutTestApi(recipe_test_api.RecipeTestApi):
"""Test API for Enviroment."""
- def test_data(self):
- rev = '1234567890123456789012345678901234567890'
- return self.m.gitiles.refs('checkout.refs', ('refs/heads/master', rev))
+ def ci_test_data(self):
+ return self.m.buildbucket.ci_build(git_repo=REPO)
+
+ def try_test_data(self):
+ return self.m.buildbucket.try_build(git_repo=REPO)
diff --git a/recipe_modules/checkout/tests/full.expected/simple.json b/recipe_modules/checkout/tests/full.expected/ci.json
similarity index 61%
rename from recipe_modules/checkout/tests/full.expected/simple.json
rename to recipe_modules/checkout/tests/full.expected/ci.json
index 2bc0def..41b63ef 100644
--- a/recipe_modules/checkout/tests/full.expected/simple.json
+++ b/recipe_modules/checkout/tests/full.expected/ci.json
@@ -4,60 +4,6 @@
"name": "checkout"
},
{
- "cmd": [],
- "name": "checkout.ensure gitiles",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "ensure",
- "-root",
- "[START_DIR]/cipd/gitiles",
- "-ensure-file",
- "infra/tools/luci/gitiles/${platform} latest",
- "-json-output",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "name": "checkout.ensure gitiles.ensure_installed",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"infra/tools/luci/gitiles/resolved-platform\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "[START_DIR]/cipd/gitiles/gitiles",
- "refs",
- "-json-output",
- "/path/to/tmp/json",
- "https://pigweed.googlesource.com/pigweed/pigweed",
- "refs/heads"
- ],
- "infra_step": true,
- "name": "checkout.refs",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"refs/heads/master\": \"1234567890123456789012345678901234567890\"@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
"cmd": [
"vpython",
"-u",
@@ -244,7 +190,7 @@
"git",
"checkout",
"-f",
- "1234567890123456789012345678901234567890"
+ "2d72510e447ab60a9728aeea2362d8be2cbd7789"
],
"cwd": "[START_DIR]/checkout",
"infra_step": true,
@@ -316,69 +262,16 @@
]
},
{
- "cmd": [],
- "name": "checkout.ensure gerrit",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "ensure",
- "-root",
- "[START_DIR]/cipd/gerrit",
- "-ensure-file",
- "infra/tools/luci/gerrit/${platform} latest",
- "-json-output",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "name": "checkout.ensure gerrit.ensure_installed",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"infra/tools/luci/gerrit/resolved-platform\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "[START_DIR]/cipd/gerrit/gerrit",
- "change-detail",
- "-host",
- "https://pigweed-review.googlesource.com",
- "-input",
- "{\"change_id\": \"1234567890123456789012345678901234567890\"}",
- "-output",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "name": "checkout.get change details",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"branch\": \"master\"@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
"cmd": [
"git",
- "rebase",
- "origin/master"
+ "--no-pager",
+ "log",
+ "--oneline",
+ "HEAD~10.."
],
"cwd": "[START_DIR]/checkout",
- "name": "checkout.git rebase",
+ "infra_step": true,
+ "name": "checkout.git log",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
diff --git a/recipe_modules/checkout/tests/full.expected/try.json b/recipe_modules/checkout/tests/full.expected/try.json
new file mode 100644
index 0000000..80416c2
--- /dev/null
+++ b/recipe_modules/checkout/tests/full.expected/try.json
@@ -0,0 +1,562 @@
+[
+ {
+ "cmd": [],
+ "name": "checkout"
+ },
+ {
+ "cmd": [],
+ "name": "checkout.fetch master",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "vpython",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "ensure-directory",
+ "--mode",
+ "0777",
+ "[START_DIR]/pigweed"
+ ],
+ "infra_step": true,
+ "name": "checkout.fetch master.makedirs",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "init"
+ ],
+ "cwd": "[START_DIR]/pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.git init",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "remote",
+ "add",
+ "origin",
+ "https://pigweed.googlesource.com/pigweed/pigweed"
+ ],
+ "cwd": "[START_DIR]/pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.git remote",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [],
+ "name": "checkout.fetch master.cache",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "vpython",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "ensure-directory",
+ "--mode",
+ "0777",
+ "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed"
+ ],
+ "cwd": "[START_DIR]/pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.cache.makedirs",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@3@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "init",
+ "--bare"
+ ],
+ "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.cache.git init",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@3@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "config",
+ "remote.origin.url",
+ "https://pigweed.googlesource.com/pigweed/pigweed"
+ ],
+ "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.cache.remote set-url",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@3@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "config",
+ "--replace-all",
+ "remote.origin.fetch",
+ "+refs/heads/*:refs/heads/*",
+ "\\+refs/heads/\\*:.*"
+ ],
+ "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.cache.git config",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@3@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "fetch",
+ "--prune",
+ "--tags",
+ "origin"
+ ],
+ "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.cache.git fetch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@3@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "vpython",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "ensure-directory",
+ "--mode",
+ "0777",
+ "[START_DIR]/pigweed/.git/objects/info"
+ ],
+ "cwd": "[START_DIR]/pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.cache.makedirs object/info",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@3@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "vpython",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "copy",
+ "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed/objects\n",
+ "[START_DIR]/pigweed/.git/objects/info/alternates"
+ ],
+ "cwd": "[START_DIR]/pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.cache.alternates",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@3@@@",
+ "@@@STEP_LOG_LINE@alternates@[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed/objects@@@",
+ "@@@STEP_LOG_END@alternates@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "fetch",
+ "--tags",
+ "origin",
+ "master"
+ ],
+ "cwd": "[START_DIR]/pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.git fetch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "checkout",
+ "-f",
+ "FETCH_HEAD"
+ ],
+ "cwd": "[START_DIR]/pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.git checkout",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.git rev-parse",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "clean",
+ "-f",
+ "-d",
+ "-x"
+ ],
+ "cwd": "[START_DIR]/pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.git clean",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [],
+ "name": "checkout.fetch master.submodule",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "submodule",
+ "sync"
+ ],
+ "cwd": "[START_DIR]/pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.submodule.git submodule sync",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@3@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "submodule",
+ "update",
+ "--init"
+ ],
+ "cwd": "[START_DIR]/pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.submodule.git submodule update",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@3@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "vpython",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "ensure-directory",
+ "--mode",
+ "0777",
+ "[START_DIR]/checkout"
+ ],
+ "infra_step": true,
+ "name": "checkout.makedirs",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "init"
+ ],
+ "cwd": "[START_DIR]/checkout",
+ "infra_step": true,
+ "name": "checkout.git init",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "remote",
+ "add",
+ "origin",
+ "https://pigweed.googlesource.com/pigweed/pigweed"
+ ],
+ "cwd": "[START_DIR]/checkout",
+ "infra_step": true,
+ "name": "checkout.git remote",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [],
+ "name": "checkout.cache",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "vpython",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "ensure-directory",
+ "--mode",
+ "0777",
+ "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed"
+ ],
+ "cwd": "[START_DIR]/checkout",
+ "infra_step": true,
+ "name": "checkout.cache.makedirs",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "init",
+ "--bare"
+ ],
+ "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+ "infra_step": true,
+ "name": "checkout.cache.git init",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "config",
+ "remote.origin.url",
+ "https://pigweed.googlesource.com/pigweed/pigweed"
+ ],
+ "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+ "infra_step": true,
+ "name": "checkout.cache.remote set-url",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "config",
+ "--replace-all",
+ "remote.origin.fetch",
+ "+refs/heads/*:refs/heads/*",
+ "\\+refs/heads/\\*:.*"
+ ],
+ "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+ "infra_step": true,
+ "name": "checkout.cache.git config",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "fetch",
+ "--prune",
+ "--tags",
+ "origin"
+ ],
+ "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+ "infra_step": true,
+ "name": "checkout.cache.git fetch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "vpython",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "ensure-directory",
+ "--mode",
+ "0777",
+ "[START_DIR]/checkout/.git/objects/info"
+ ],
+ "cwd": "[START_DIR]/checkout",
+ "infra_step": true,
+ "name": "checkout.cache.makedirs object/info",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "vpython",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "copy",
+ "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed/objects\n",
+ "[START_DIR]/checkout/.git/objects/info/alternates"
+ ],
+ "cwd": "[START_DIR]/checkout",
+ "infra_step": true,
+ "name": "checkout.cache.alternates",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@",
+ "@@@STEP_LOG_LINE@alternates@[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed/objects@@@",
+ "@@@STEP_LOG_END@alternates@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "fetch",
+ "--tags",
+ "origin",
+ "refs/changes/56/123456/7"
+ ],
+ "cwd": "[START_DIR]/checkout",
+ "infra_step": true,
+ "name": "checkout.git fetch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "checkout",
+ "-f",
+ "FETCH_HEAD"
+ ],
+ "cwd": "[START_DIR]/checkout",
+ "infra_step": true,
+ "name": "checkout.git checkout",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/checkout",
+ "infra_step": true,
+ "name": "checkout.git rev-parse",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "clean",
+ "-f",
+ "-d",
+ "-x"
+ ],
+ "cwd": "[START_DIR]/checkout",
+ "infra_step": true,
+ "name": "checkout.git clean",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [],
+ "name": "checkout.submodule",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "submodule",
+ "sync"
+ ],
+ "cwd": "[START_DIR]/checkout",
+ "infra_step": true,
+ "name": "checkout.submodule.git submodule sync",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "submodule",
+ "update",
+ "--init"
+ ],
+ "cwd": "[START_DIR]/checkout",
+ "infra_step": true,
+ "name": "checkout.submodule.git submodule update",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "rebase",
+ "deadbeef"
+ ],
+ "cwd": "[START_DIR]/checkout",
+ "infra_step": true,
+ "name": "checkout.git rebase",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "--no-pager",
+ "log",
+ "--oneline",
+ "HEAD~10.."
+ ],
+ "cwd": "[START_DIR]/checkout",
+ "infra_step": true,
+ "name": "checkout.git log",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "name": "$result"
+ }
+]
\ No newline at end of file
diff --git a/recipe_modules/checkout/tests/full.py b/recipe_modules/checkout/tests/full.py
index d439168..f01baf3 100644
--- a/recipe_modules/checkout/tests/full.py
+++ b/recipe_modules/checkout/tests/full.py
@@ -26,4 +26,6 @@
def GenTests(api): # pylint: disable=invalid-name
- yield api.test('simple') + api.checkout.test_data()
+ yield api.test('ci') + api.checkout.ci_test_data()
+
+ yield api.test('try') + api.checkout.try_test_data()
diff --git a/recipes/pigweed.expected/pigweed.json b/recipes/pigweed.expected/pigweed.json
index 62dbaf5..8329e1e 100644
--- a/recipes/pigweed.expected/pigweed.json
+++ b/recipes/pigweed.expected/pigweed.json
@@ -4,60 +4,6 @@
"name": "checkout"
},
{
- "cmd": [],
- "name": "checkout.ensure gitiles",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "ensure",
- "-root",
- "[START_DIR]/cipd/gitiles",
- "-ensure-file",
- "infra/tools/luci/gitiles/${platform} latest",
- "-json-output",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "name": "checkout.ensure gitiles.ensure_installed",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"infra/tools/luci/gitiles/resolved-platform\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "[START_DIR]/cipd/gitiles/gitiles",
- "refs",
- "-json-output",
- "/path/to/tmp/json",
- "https://pigweed.googlesource.com/pigweed/pigweed",
- "refs/heads"
- ],
- "infra_step": true,
- "name": "checkout.refs",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"refs/heads/master\": \"1234567890123456789012345678901234567890\"@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
"cmd": [
"vpython",
"-u",
@@ -244,7 +190,7 @@
"git",
"checkout",
"-f",
- "1234567890123456789012345678901234567890"
+ "2d72510e447ab60a9728aeea2362d8be2cbd7789"
],
"cwd": "[START_DIR]/checkout",
"infra_step": true,
@@ -316,69 +262,16 @@
]
},
{
- "cmd": [],
- "name": "checkout.ensure gerrit",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@"
- ]
- },
- {
- "cmd": [
- "cipd",
- "ensure",
- "-root",
- "[START_DIR]/cipd/gerrit",
- "-ensure-file",
- "infra/tools/luci/gerrit/${platform} latest",
- "-json-output",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "name": "checkout.ensure gerrit.ensure_installed",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"infra/tools/luci/gerrit/resolved-platform\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "[START_DIR]/cipd/gerrit/gerrit",
- "change-detail",
- "-host",
- "https://pigweed-review.googlesource.com",
- "-input",
- "{\"change_id\": \"1234567890123456789012345678901234567890\"}",
- "-output",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "name": "checkout.get change details",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"branch\": \"master\"@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
"cmd": [
"git",
- "rebase",
- "origin/master"
+ "--no-pager",
+ "log",
+ "--oneline",
+ "HEAD~10.."
],
"cwd": "[START_DIR]/checkout",
- "name": "checkout.git rebase",
+ "infra_step": true,
+ "name": "checkout.git log",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
diff --git a/recipes/pigweed.expected/step.json b/recipes/pigweed.expected/step.json
index b2b7a39..d4a3067 100644
--- a/recipes/pigweed.expected/step.json
+++ b/recipes/pigweed.expected/step.json
@@ -5,56 +5,268 @@
},
{
"cmd": [],
- "name": "checkout.ensure gitiles",
+ "name": "checkout.fetch master",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
},
{
"cmd": [
- "cipd",
- "ensure",
- "-root",
- "[START_DIR]/cipd/gitiles",
- "-ensure-file",
- "infra/tools/luci/gitiles/${platform} latest",
- "-json-output",
- "/path/to/tmp/json"
+ "vpython",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "ensure-directory",
+ "--mode",
+ "0777",
+ "[START_DIR]/pigweed"
],
"infra_step": true,
- "name": "checkout.ensure gitiles.ensure_installed",
+ "name": "checkout.fetch master.makedirs",
"~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"infra/tools/luci/gitiles/resolved-platform\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
+ "@@@STEP_NEST_LEVEL@2@@@"
]
},
{
"cmd": [
- "[START_DIR]/cipd/gitiles/gitiles",
- "refs",
- "-json-output",
- "/path/to/tmp/json",
- "https://pigweed.googlesource.com/pigweed/pigweed",
- "refs/heads"
+ "git",
+ "init"
],
+ "cwd": "[START_DIR]/pigweed",
"infra_step": true,
- "name": "checkout.refs",
+ "name": "checkout.fetch master.git init",
"~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"refs/heads/master\": \"1234567890123456789012345678901234567890\"@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "remote",
+ "add",
+ "origin",
+ "https://pigweed.googlesource.com/pigweed/pigweed"
+ ],
+ "cwd": "[START_DIR]/pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.git remote",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [],
+ "name": "checkout.fetch master.cache",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "vpython",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "ensure-directory",
+ "--mode",
+ "0777",
+ "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed"
+ ],
+ "cwd": "[START_DIR]/pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.cache.makedirs",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@3@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "init",
+ "--bare"
+ ],
+ "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.cache.git init",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@3@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "config",
+ "remote.origin.url",
+ "https://pigweed.googlesource.com/pigweed/pigweed"
+ ],
+ "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.cache.remote set-url",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@3@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "config",
+ "--replace-all",
+ "remote.origin.fetch",
+ "+refs/heads/*:refs/heads/*",
+ "\\+refs/heads/\\*:.*"
+ ],
+ "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.cache.git config",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@3@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "fetch",
+ "--prune",
+ "--tags",
+ "origin"
+ ],
+ "cwd": "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.cache.git fetch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@3@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "vpython",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "ensure-directory",
+ "--mode",
+ "0777",
+ "[START_DIR]/pigweed/.git/objects/info"
+ ],
+ "cwd": "[START_DIR]/pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.cache.makedirs object/info",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@3@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "vpython",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "copy",
+ "[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed/objects\n",
+ "[START_DIR]/pigweed/.git/objects/info/alternates"
+ ],
+ "cwd": "[START_DIR]/pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.cache.alternates",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@3@@@",
+ "@@@STEP_LOG_LINE@alternates@[CACHE]/git/pigweed.googlesource.com-pigweed-pigweed/objects@@@",
+ "@@@STEP_LOG_END@alternates@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "fetch",
+ "--tags",
+ "origin",
+ "master"
+ ],
+ "cwd": "[START_DIR]/pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.git fetch",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "checkout",
+ "-f",
+ "FETCH_HEAD"
+ ],
+ "cwd": "[START_DIR]/pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.git checkout",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "rev-parse",
+ "HEAD"
+ ],
+ "cwd": "[START_DIR]/pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.git rev-parse",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "clean",
+ "-f",
+ "-d",
+ "-x"
+ ],
+ "cwd": "[START_DIR]/pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.git clean",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [],
+ "name": "checkout.fetch master.submodule",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "submodule",
+ "sync"
+ ],
+ "cwd": "[START_DIR]/pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.submodule.git submodule sync",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@3@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "git",
+ "submodule",
+ "update",
+ "--init"
+ ],
+ "cwd": "[START_DIR]/pigweed",
+ "infra_step": true,
+ "name": "checkout.fetch master.submodule.git submodule update",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@3@@@"
]
},
{
@@ -230,7 +442,8 @@
"git",
"fetch",
"--tags",
- "origin"
+ "origin",
+ "refs/changes/56/123456/7"
],
"cwd": "[START_DIR]/checkout",
"infra_step": true,
@@ -244,7 +457,7 @@
"git",
"checkout",
"-f",
- "1234567890123456789012345678901234567890"
+ "FETCH_HEAD"
],
"cwd": "[START_DIR]/checkout",
"infra_step": true,
@@ -316,69 +529,29 @@
]
},
{
- "cmd": [],
- "name": "checkout.ensure gerrit",
+ "cmd": [
+ "git",
+ "rebase",
+ "deadbeef"
+ ],
+ "cwd": "[START_DIR]/checkout",
+ "infra_step": true,
+ "name": "checkout.git rebase",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
},
{
"cmd": [
- "cipd",
- "ensure",
- "-root",
- "[START_DIR]/cipd/gerrit",
- "-ensure-file",
- "infra/tools/luci/gerrit/${platform} latest",
- "-json-output",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "name": "checkout.ensure gerrit.ensure_installed",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@2@@@",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
- "@@@STEP_LOG_LINE@json.output@ {@@@",
- "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-latest----------\", @@@",
- "@@@STEP_LOG_LINE@json.output@ \"package\": \"infra/tools/luci/gerrit/resolved-platform\"@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@ ]@@@",
- "@@@STEP_LOG_LINE@json.output@ }@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
- "[START_DIR]/cipd/gerrit/gerrit",
- "change-detail",
- "-host",
- "https://pigweed-review.googlesource.com",
- "-input",
- "{\"change_id\": \"1234567890123456789012345678901234567890\"}",
- "-output",
- "/path/to/tmp/json"
- ],
- "infra_step": true,
- "name": "checkout.get change details",
- "~followup_annotations": [
- "@@@STEP_NEST_LEVEL@1@@@",
- "@@@STEP_LOG_LINE@json.output@{@@@",
- "@@@STEP_LOG_LINE@json.output@ \"branch\": \"master\"@@@",
- "@@@STEP_LOG_LINE@json.output@}@@@",
- "@@@STEP_LOG_END@json.output@@@"
- ]
- },
- {
- "cmd": [
"git",
- "rebase",
- "origin/master"
+ "--no-pager",
+ "log",
+ "--oneline",
+ "HEAD~10.."
],
"cwd": "[START_DIR]/checkout",
- "name": "checkout.git rebase",
+ "infra_step": true,
+ "name": "checkout.git log",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
]
diff --git a/recipes/pigweed.py b/recipes/pigweed.py
index ce7b5e3..631f5e1 100644
--- a/recipes/pigweed.py
+++ b/recipes/pigweed.py
@@ -67,13 +67,13 @@
def GenTests(api): # pylint: disable=invalid-name
yield (
api.test('pigweed') +
- api.checkout.test_data() +
+ api.checkout.ci_test_data() +
api.environment.test_data()
)
yield (
api.test('step') +
api.properties(step=['step1', 'step2']) +
- api.checkout.test_data() +
+ api.checkout.try_test_data() +
api.environment.test_data()
)