infra: Also support gitlies input to support use as post-submit

BUG=1300370
TEST=./recipes.py test run

Change-Id: I5db70526f728aebd9dd253da0d85056a340c7c22
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3627054
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Yuanjun Huang <yuanjunh@google.com>
This commit is contained in:
Dennis Kempin 2022-05-04 23:07:55 +00:00
parent 9ab4f29e7a
commit 1f43c67a12
3 changed files with 114 additions and 18 deletions

View file

@ -0,0 +1,91 @@
[
{
"cmd": [
"vpython3",
"-u",
"RECIPE_MODULE[depot_tools::bot_update]/resources/bot_update.py",
"--spec-path",
"cache_dir = '[CACHE]/git'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'http://chromium.googlesource.com/crosvm/crosvm'}]",
"--revision_mapping_file",
"{\"got_revision\": \"src\"}",
"--git-cache-dir",
"[CACHE]/git",
"--cleanup-dir",
"[CLEANUP]/bot_update",
"--output_json",
"/path/to/tmp/json",
"--revision",
"src@2d72510e447ab60a9728aeea2362d8be2cbd7789",
"--refs",
"refs/heads/main"
],
"cwd": "[CACHE]/builder",
"env": {
"DEPOT_TOOLS_REPORT_BUILD": "crosvm/ci/builder/8945511751514863184",
"GIT_HTTP_LOW_SPEED_LIMIT": "102400",
"GIT_HTTP_LOW_SPEED_TIME": "1800"
},
"env_suffixes": {
"DEPOT_TOOLS_UPDATE": [
"0"
],
"PATH": [
"RECIPE_REPO[depot_tools]"
]
},
"infra_step": true,
"luci_context": {
"realm": {
"name": "crosvm:ci"
},
"resultdb": {
"current_invocation": {
"name": "invocations/build:8945511751514863184",
"update_token": "token"
},
"hostname": "rdbhost"
}
},
"name": "bot_update",
"~followup_annotations": [
"@@@STEP_TEXT@Some step text@@@",
"@@@STEP_LOG_LINE@json.output@{@@@",
"@@@STEP_LOG_LINE@json.output@ \"did_run\": true, @@@",
"@@@STEP_LOG_LINE@json.output@ \"fixed_revisions\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"src\": \"2d72510e447ab60a9728aeea2362d8be2cbd7789\"@@@",
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"manifest\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"src\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"repository\": \"https://fake.org/src.git\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"revision\": \"2d72510e447ab60a9728aeea2362d8be2cbd7789\"@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"patch_failure\": false, @@@",
"@@@STEP_LOG_LINE@json.output@ \"patch_root\": \"src\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"properties\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"got_revision\": \"2d72510e447ab60a9728aeea2362d8be2cbd7789\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"got_revision_cp\": \"refs/heads/main@{#170242}\"@@@",
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"root\": \"src\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"source_manifest\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"directories\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"src\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"git_checkout\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"repo_url\": \"https://fake.org/src.git\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"revision\": \"2d72510e447ab60a9728aeea2362d8be2cbd7789\"@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"version\": 0@@@",
"@@@STEP_LOG_LINE@json.output@ }, @@@",
"@@@STEP_LOG_LINE@json.output@ \"step_text\": \"Some step text\"@@@",
"@@@STEP_LOG_LINE@json.output@}@@@",
"@@@STEP_LOG_END@json.output@@@",
"@@@SET_BUILD_PROPERTY@got_revision@\"2d72510e447ab60a9728aeea2362d8be2cbd7789\"@@@",
"@@@SET_BUILD_PROPERTY@got_revision_cp@\"refs/heads/main@{#170242}\"@@@"
]
},
{
"name": "$result"
}
]

View file

@ -61,7 +61,7 @@
"-u",
"RECIPE_MODULE[depot_tools::bot_update]/resources/bot_update.py",
"--spec-path",
"cache_dir = '[CACHE]/git'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/crosvm/crosvm'}]",
"cache_dir = '[CACHE]/git'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'http://chromium.googlesource.com/crosvm/crosvm'}]",
"--patch_root",
"src",
"--revision_mapping_file",

View file

@ -11,25 +11,20 @@ DEPS = [
def RunSteps(api):
# TODO(denniskempin): Consider using git directly for simpler config
cl = api.buildbucket.build.input.gerrit_changes[0]
gs_suffix = "-review.googlesource.com"
host = cl.host
if host.endswith(gs_suffix):
host = "%s.googlesource.com" % host[: -len(gs_suffix)]
gitilies = api.buildbucket.build.input.gitiles_commit
if gitilies.host:
url = "http://%s/%s" % (gitilies.host, gitilies.project)
else:
cl = api.buildbucket.build.input.gerrit_changes[0]
gs_suffix = "-review.googlesource.com"
host = cl.host
if host.endswith(gs_suffix):
host = "%s.googlesource.com" % host[: -len(gs_suffix)]
url = "http://%s/%s" % (host, cl.project)
gclient_config = api.gclient.make_config()
s = gclient_config.solutions.add()
s.url = "https://%s/%s" % (host, cl.project)
# name is the subfolder under api.path['cache'].join('builder') the
# repo will be checked out at. For simplicity, I've picked `src`.
#
# Note that gclient (and by extension, bot_update), allow for complicated
# multi-repo layouts and dependency inclusion (via "DEPS" files). There are
# other repo management tools and techniques available, but this one is what
# chrome currently uses and is tuned to have reasonable performance by default
# via caches.
s.url = url
s.name = "src"
gclient_config.got_revision_mapping[s.name] = "got_revision"
@ -46,7 +41,7 @@ def RunSteps(api):
def GenTests(api):
yield api.test(
"basic",
"basic try",
# These are just to make the JSON expectation file data look closer to
# reality. Project and git_repo will be filled in "for real" by the LUCI
# Change Verifier service when it creates your build.
@ -55,3 +50,13 @@ def GenTests(api):
git_repo="https://chromium.googlesource.com/crosvm/crosvm",
),
)
yield api.test(
"basic ci",
# These are just to make the JSON expectation file data look closer to
# reality. Project and git_repo will be filled in "for real" by the LUCI
# Change Verifier service when it creates your build.
api.buildbucket.ci_build(
project="crosvm",
git_repo="https://chromium.googlesource.com/crosvm/crosvm",
),
)