infra: Add health check builder

The builder calls ./tools/health-check for fmt/clippy/python checks.

BUG=b:233913455
TEST=recipes.py run health_check

Change-Id: Ia4b8298ef921b33a687d4e64956fc1f017649e7f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3668814
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
Dennis Kempin 2022-05-25 21:21:31 +00:00
parent bcbf2cb678
commit cb99b70b1d
3 changed files with 132 additions and 0 deletions

View file

@ -9,6 +9,7 @@
* [build_linux](#recipes-build_linux) (Python3 ✅)
* [crosvm:examples/container](#recipes-crosvm_examples_container) (Python3 ✅)
* [crosvm:examples/prepare_source](#recipes-crosvm_examples_prepare_source) (Python3 ✅)
* [health_check](#recipes-health_check) (Python3 ✅)
## Recipe Modules
### *recipe_modules* / [crosvm](/infra/recipe_modules/crosvm)
@ -64,6 +65,13 @@ PYTHON_VERSION_COMPATIBILITY: PY3
PYTHON_VERSION_COMPATIBILITY: PY3
&mdash; **def [RunSteps](/infra/recipe_modules/crosvm/examples/prepare_source.py#18)(api):**
### *recipes* / [health\_check](/infra/recipes/health_check.py)
[DEPS](/infra/recipes/health_check.py#10): [crosvm](#recipe_modules-crosvm), [recipe\_engine/buildbucket][recipe_engine/recipe_modules/buildbucket], [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/step][recipe_engine/recipe_modules/step]
PYTHON_VERSION_COMPATIBILITY: PY3
&mdash; **def [RunSteps](/infra/recipes/health_check.py#19)(api):**
[depot_tools/recipe_modules/bot_update]: https://chromium.googlesource.com/chromium/tools/depot_tools.git/+/8a87603683bda769d437e48cc1a7494a2e237ead/recipes/README.recipes.md#recipe_modules-bot_update
[depot_tools/recipe_modules/gclient]: https://chromium.googlesource.com/chromium/tools/depot_tools.git/+/8a87603683bda769d437e48cc1a7494a2e237ead/recipes/README.recipes.md#recipe_modules-gclient

View file

@ -0,0 +1,90 @@
[
{
"cmd": [
"./tools/dev_container",
"--verbose",
"./tools/health-check",
"python"
],
"cwd": "[CACHE]/builder/crosvm",
"luci_context": {
"realm": {
"name": "crosvm/crosvm:ci"
},
"resultdb": {
"current_invocation": {
"name": "invocations/build:8945511751514863184",
"update_token": "token"
},
"hostname": "rdbhost"
}
},
"name": "Checking python"
},
{
"cmd": [
"./tools/dev_container",
"--verbose",
"./tools/health-check",
"misc"
],
"cwd": "[CACHE]/builder/crosvm",
"luci_context": {
"realm": {
"name": "crosvm/crosvm:ci"
},
"resultdb": {
"current_invocation": {
"name": "invocations/build:8945511751514863184",
"update_token": "token"
},
"hostname": "rdbhost"
}
},
"name": "Checking misc"
},
{
"cmd": [
"./tools/dev_container",
"--verbose",
"./tools/health-check",
"fmt"
],
"cwd": "[CACHE]/builder/crosvm",
"luci_context": {
"realm": {
"name": "crosvm/crosvm:ci"
},
"resultdb": {
"current_invocation": {
"name": "invocations/build:8945511751514863184",
"update_token": "token"
},
"hostname": "rdbhost"
}
},
"name": "Checking fmt"
},
{
"cmd": [
"./tools/dev_container",
"--verbose",
"./tools/health-check",
"clippy"
],
"cwd": "[CACHE]/builder/crosvm",
"luci_context": {
"realm": {
"name": "crosvm/crosvm:ci"
},
"resultdb": {
"current_invocation": {
"name": "invocations/build:8945511751514863184",
"update_token": "token"
},
"hostname": "rdbhost"
}
},
"name": "Checking clippy"
}
]

View file

@ -0,0 +1,34 @@
# Copyright 2022 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import re
from recipe_engine.post_process import Filter
PYTHON_VERSION_COMPATIBILITY = "PY3"
DEPS = [
"crosvm",
"recipe_engine/buildbucket",
"recipe_engine/context",
"recipe_engine/properties",
"recipe_engine/step",
]
def RunSteps(api):
api.crosvm.prepare_source()
api.crosvm.prepare_container()
with api.context(cwd=api.crosvm.source_dir):
for check in ("python", "misc", "fmt", "clippy"):
api.crosvm.step_in_container("Checking %s" % check, ["./tools/health-check", check])
def GenTests(api):
yield (
api.test(
"basic",
api.buildbucket.ci_build(project="crosvm/crosvm"),
)
+ api.post_process(Filter().include_re(r"Checking.*"))
)