crosvm/infra/recipes/build_chromeos_hatch.py
Zihan Chen 988858b66b infra: Add build_chromeos_container builder
Add a new builder to build crosvm in crOS tree, and all the
depencies of this new builder.

BUG=b:240692674
TESTED=led get-builder luci.crosvm.ci:chromeos_amd64-generic | led edit-cr-cl https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3966928 | led edit-recipe-bundle | led edit -r build_chromeos_hatch | led launch

Change-Id: Id2f284139922916edd2dd584f576da9fb3445518
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3966928
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Zihan Chen <zihanchen@google.com>
2022-10-26 23:05:08 +00:00

69 lines
1.8 KiB
Python

# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from recipe_engine.post_process import Filter
PYTHON_VERSION_COMPATIBILITY = "PY3"
DEPS = [
"crosvm",
"depot_tools/depot_tools",
"recipe_engine/buildbucket",
"recipe_engine/context",
"recipe_engine/properties",
"recipe_engine/step",
]
def RunSteps(api):
with api.crosvm.cros_container_build_context():
gitilies = api.buildbucket.build.input.gitiles_commit
upstream_url = "https://chromium.googlesource.com/crosvm/crosvm"
revision = gitilies.id or "HEAD"
api.crosvm.step_in_container(
"Sync repo",
[
"repo",
"sync",
"-j8",
"--current-branch",
],
cros=True,
)
# Overwrite crosvm with the upstream revision we need to test
api.crosvm.step_in_container(
"Fetch upstream crosvm", ["git", "fetch", upstream_url], cros=True
)
api.crosvm.step_in_container(
"Checkout upstream revision", ["git", "checkout", revision], cros=True
)
api.crosvm.step_in_container(
"cros-workon-hatch crosvm",
["cros_sdk", "cros-workon-hatch", "start", "crosvm"],
cros=True,
)
api.crosvm.step_in_container(
"Build crosvm",
[
"cros_sdk",
"emerge-hatch",
"crosvm",
],
cros=True,
)
def GenTests(api):
filter_steps = Filter("Build crosvm")
yield (
api.test(
"build_chromeos_hatch",
api.buildbucket.ci_build(project="crosvm/crosvm"),
)
+ api.post_process(filter_steps)
)