mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-05 10:10:41 +00:00
infra: Set git name/email on all builders
Without, gerrit will not let us submit code and we won't be able to use repo. BUG=b:233913797 TEST=recipes.py test run Change-Id: I59dc6633c716288094e02f38d613343e69c8c3e9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3674004 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
f66af4f3f8
commit
9c313915f5
6 changed files with 160 additions and 12 deletions
|
@ -15,7 +15,7 @@
|
|||
|
||||
### *recipe_modules* / [crosvm](/infra/recipe_modules/crosvm)
|
||||
|
||||
[DEPS](/infra/recipe_modules/crosvm/__init__.py#7): [depot\_tools/bot\_update][depot_tools/recipe_modules/bot_update], [depot\_tools/gclient][depot_tools/recipe_modules/gclient], [recipe\_engine/buildbucket][recipe_engine/recipe_modules/buildbucket], [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/step][recipe_engine/recipe_modules/step]
|
||||
[DEPS](/infra/recipe_modules/crosvm/__init__.py#7): [depot\_tools/bot\_update][depot_tools/recipe_modules/bot_update], [depot\_tools/gclient][depot_tools/recipe_modules/gclient], [depot\_tools/git][depot_tools/recipe_modules/git], [recipe\_engine/buildbucket][recipe_engine/recipe_modules/buildbucket], [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/step][recipe_engine/recipe_modules/step]
|
||||
|
||||
PYTHON_VERSION_COMPATIBILITY: PY3
|
||||
|
||||
|
@ -23,7 +23,7 @@ PYTHON_VERSION_COMPATIBILITY: PY3
|
|||
|
||||
Crosvm specific functionality shared between recipes.
|
||||
|
||||
— **def [build\_context](/infra/recipe_modules/crosvm/api.py#21)(self, source=True, container=True):**
|
||||
— **def [build\_context](/infra/recipe_modules/crosvm/api.py#27)(self, source=True, container=True):**
|
||||
|
||||
Prepares everything needed to build crosvm on the revision that needs to be verified.
|
||||
|
||||
|
@ -36,9 +36,11 @@ Usage:
|
|||
|
||||
  **@property**<br>— **def [builder\_dir](/infra/recipe_modules/crosvm/api.py#17)(self):**
|
||||
|
||||
— **def [prepare\_container](/infra/recipe_modules/crosvm/api.py#59)(self):**
|
||||
— **def [prepare\_container](/infra/recipe_modules/crosvm/api.py#65)(self):**
|
||||
|
||||
— **def [prepare\_source](/infra/recipe_modules/crosvm/api.py#38)(self):**
|
||||
— **def [prepare\_git](/infra/recipe_modules/crosvm/api.py#79)(self):**
|
||||
|
||||
— **def [prepare\_source](/infra/recipe_modules/crosvm/api.py#45)(self):**
|
||||
|
||||
Prepares the local crosvm source for testing in `self.source_dir`
|
||||
|
||||
|
@ -47,26 +49,26 @@ change to be tested.
|
|||
|
||||
  **@property**<br>— **def [source\_dir](/infra/recipe_modules/crosvm/api.py#13)(self):**
|
||||
|
||||
— **def [step\_in\_container](/infra/recipe_modules/crosvm/api.py#73)(self, step_name, command):**
|
||||
— **def [step\_in\_container](/infra/recipe_modules/crosvm/api.py#90)(self, step_name, command):**
|
||||
|
||||
Runs a luci step inside the crosvm dev container.
|
||||
## Recipes
|
||||
|
||||
### *recipes* / [build\_chromeos](/infra/recipes/build_chromeos.py)
|
||||
|
||||
[DEPS](/infra/recipes/build_chromeos.py#9): [crosvm](#recipe_modules-crosvm), [depot\_tools/depot\_tools][depot_tools/recipe_modules/depot_tools], [recipe\_engine/buildbucket][recipe_engine/recipe_modules/buildbucket], [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/step][recipe_engine/recipe_modules/step]
|
||||
[DEPS](/infra/recipes/build_chromeos.py#10): [crosvm](#recipe_modules-crosvm), [depot\_tools/depot\_tools][depot_tools/recipe_modules/depot_tools], [recipe\_engine/buildbucket][recipe_engine/recipe_modules/buildbucket], [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/step][recipe_engine/recipe_modules/step]
|
||||
|
||||
PYTHON_VERSION_COMPATIBILITY: PY3
|
||||
|
||||
— **def [BuildAndTest](/infra/recipes/build_chromeos.py#76)(api, board):**
|
||||
— **def [BuildAndTest](/infra/recipes/build_chromeos.py#80)(api, board):**
|
||||
|
||||
— **def [CleanUp](/infra/recipes/build_chromeos.py#89)(api):**
|
||||
— **def [CleanUp](/infra/recipes/build_chromeos.py#93)(api):**
|
||||
|
||||
— **def [PrepareBuild](/infra/recipes/build_chromeos.py#61)(api):**
|
||||
— **def [PrepareBuild](/infra/recipes/build_chromeos.py#65)(api):**
|
||||
|
||||
— **def [RunSteps](/infra/recipes/build_chromeos.py#94)(api, properties):**
|
||||
— **def [RunSteps](/infra/recipes/build_chromeos.py#98)(api, properties):**
|
||||
|
||||
— **def [SetupSource](/infra/recipes/build_chromeos.py#27)(api, workspace):**
|
||||
— **def [SetupSource](/infra/recipes/build_chromeos.py#28)(api, workspace):**
|
||||
### *recipes* / [build\_linux](/infra/recipes/build_linux.py)
|
||||
|
||||
[DEPS](/infra/recipes/build_linux.py#11): [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]
|
||||
|
@ -103,6 +105,7 @@ PYTHON_VERSION_COMPATIBILITY: PY3
|
|||
[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/depot_tools]: https://chromium.googlesource.com/chromium/tools/depot_tools.git/+/8a87603683bda769d437e48cc1a7494a2e237ead/recipes/README.recipes.md#recipe_modules-depot_tools
|
||||
[depot_tools/recipe_modules/gclient]: https://chromium.googlesource.com/chromium/tools/depot_tools.git/+/8a87603683bda769d437e48cc1a7494a2e237ead/recipes/README.recipes.md#recipe_modules-gclient
|
||||
[depot_tools/recipe_modules/git]: https://chromium.googlesource.com/chromium/tools/depot_tools.git/+/8a87603683bda769d437e48cc1a7494a2e237ead/recipes/README.recipes.md#recipe_modules-git
|
||||
[recipe_engine/recipe_modules/buildbucket]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/7b42800366a15f34b28e62f6bcb1cddcb2206db0/README.recipes.md#recipe_modules-buildbucket
|
||||
[recipe_engine/recipe_modules/context]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/7b42800366a15f34b28e62f6bcb1cddcb2206db0/README.recipes.md#recipe_modules-context
|
||||
[recipe_engine/recipe_modules/file]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/7b42800366a15f34b28e62f6bcb1cddcb2206db0/README.recipes.md#recipe_modules-file
|
||||
|
|
|
@ -7,6 +7,7 @@ PYTHON_VERSION_COMPATIBILITY = "PY3"
|
|||
DEPS = [
|
||||
"depot_tools/bot_update",
|
||||
"depot_tools/gclient",
|
||||
"depot_tools/git",
|
||||
"recipe_engine/buildbucket",
|
||||
"recipe_engine/context",
|
||||
"recipe_engine/file",
|
||||
|
|
|
@ -18,6 +18,12 @@ class CrosvmApi(recipe_api.RecipeApi):
|
|||
def builder_dir(self):
|
||||
return self.m.path["cache"].join("builder")
|
||||
|
||||
def __set_git_config(self, prop, value):
|
||||
self.m.step(
|
||||
"Set git config: %s" % prop,
|
||||
["git", "config", "--global", prop, value],
|
||||
)
|
||||
|
||||
def build_context(self, source=True, container=True):
|
||||
"""
|
||||
Prepares everything needed to build crosvm on the revision that needs to be verified.
|
||||
|
@ -29,6 +35,7 @@ class CrosvmApi(recipe_api.RecipeApi):
|
|||
with api.crosvm.build_context():
|
||||
api.crosvm.step_in_container("build crosvm", ["cargo build"])
|
||||
"""
|
||||
self.prepare_git()
|
||||
if source:
|
||||
self.prepare_source()
|
||||
if container:
|
||||
|
@ -44,7 +51,6 @@ class CrosvmApi(recipe_api.RecipeApi):
|
|||
"""
|
||||
with self.m.step.nest("Prepare source"):
|
||||
self.m.file.ensure_directory("Ensure builder_dir exists", self.builder_dir)
|
||||
|
||||
with self.m.context(cwd=self.builder_dir):
|
||||
gclient_config = self.m.gclient.make_config()
|
||||
s = gclient_config.solutions.add()
|
||||
|
@ -70,6 +76,17 @@ class CrosvmApi(recipe_api.RecipeApi):
|
|||
)
|
||||
self.m.crosvm.step_in_container("Ensure dev container exists", ["true"])
|
||||
|
||||
def prepare_git(self):
|
||||
with self.m.step.nest("Prepare git"):
|
||||
with self.m.context(cwd=self.m.path["start_dir"]):
|
||||
name = self.m.git.config_get("user.name")
|
||||
email = self.m.git.config_get("user.email")
|
||||
if not name or not email:
|
||||
self.__set_git_config("user.name", "Crosvm Bot")
|
||||
self.__set_git_config(
|
||||
"user.email", "crosvm-bot@crosvm-infra.iam.gserviceaccount.com"
|
||||
)
|
||||
|
||||
def step_in_container(self, step_name, command):
|
||||
"""
|
||||
Runs a luci step inside the crosvm dev container.
|
||||
|
|
|
@ -1,4 +1,60 @@
|
|||
[
|
||||
{
|
||||
"cmd": [],
|
||||
"name": "Prepare git"
|
||||
},
|
||||
{
|
||||
"cmd": [
|
||||
"git",
|
||||
"config",
|
||||
"--get",
|
||||
"user.name"
|
||||
],
|
||||
"infra_step": true,
|
||||
"name": "Prepare git.git config user.name",
|
||||
"~followup_annotations": [
|
||||
"@@@STEP_NEST_LEVEL@1@@@"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cmd": [
|
||||
"git",
|
||||
"config",
|
||||
"--get",
|
||||
"user.email"
|
||||
],
|
||||
"infra_step": true,
|
||||
"name": "Prepare git.git config user.email",
|
||||
"~followup_annotations": [
|
||||
"@@@STEP_NEST_LEVEL@1@@@"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cmd": [
|
||||
"git",
|
||||
"config",
|
||||
"--global",
|
||||
"user.name",
|
||||
"Crosvm Bot"
|
||||
],
|
||||
"name": "Prepare git.Set git config: user.name",
|
||||
"~followup_annotations": [
|
||||
"@@@STEP_NEST_LEVEL@1@@@"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cmd": [
|
||||
"git",
|
||||
"config",
|
||||
"--global",
|
||||
"user.email",
|
||||
"crosvm-bot@crosvm-infra.iam.gserviceaccount.com"
|
||||
],
|
||||
"name": "Prepare git.Set git config: user.email",
|
||||
"~followup_annotations": [
|
||||
"@@@STEP_NEST_LEVEL@1@@@"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cmd": [],
|
||||
"name": "Prepare source"
|
||||
|
|
|
@ -14,6 +14,74 @@
|
|||
"infra_step": true,
|
||||
"name": "Ensure workspace exists"
|
||||
},
|
||||
{
|
||||
"cmd": [],
|
||||
"name": "Prepare git"
|
||||
},
|
||||
{
|
||||
"cmd": [
|
||||
"git",
|
||||
"config",
|
||||
"--get",
|
||||
"user.name"
|
||||
],
|
||||
"env": {
|
||||
"DEPOT_TOOLS_UPDATE": "0"
|
||||
},
|
||||
"infra_step": true,
|
||||
"name": "Prepare git.git config user.name",
|
||||
"~followup_annotations": [
|
||||
"@@@STEP_NEST_LEVEL@1@@@"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cmd": [
|
||||
"git",
|
||||
"config",
|
||||
"--get",
|
||||
"user.email"
|
||||
],
|
||||
"env": {
|
||||
"DEPOT_TOOLS_UPDATE": "0"
|
||||
},
|
||||
"infra_step": true,
|
||||
"name": "Prepare git.git config user.email",
|
||||
"~followup_annotations": [
|
||||
"@@@STEP_NEST_LEVEL@1@@@"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cmd": [
|
||||
"git",
|
||||
"config",
|
||||
"--global",
|
||||
"user.name",
|
||||
"Crosvm Bot"
|
||||
],
|
||||
"env": {
|
||||
"DEPOT_TOOLS_UPDATE": "0"
|
||||
},
|
||||
"name": "Prepare git.Set git config: user.name",
|
||||
"~followup_annotations": [
|
||||
"@@@STEP_NEST_LEVEL@1@@@"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cmd": [
|
||||
"git",
|
||||
"config",
|
||||
"--global",
|
||||
"user.email",
|
||||
"crosvm-bot@crosvm-infra.iam.gserviceaccount.com"
|
||||
],
|
||||
"env": {
|
||||
"DEPOT_TOOLS_UPDATE": "0"
|
||||
},
|
||||
"name": "Prepare git.Set git config: user.email",
|
||||
"~followup_annotations": [
|
||||
"@@@STEP_NEST_LEVEL@1@@@"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cmd": [
|
||||
"RECIPE_REPO[depot_tools]/repo",
|
||||
|
|
|
@ -30,6 +30,9 @@ def SetupSource(api, workspace):
|
|||
upstream_url = "https://chromium.googlesource.com/crosvm/crosvm"
|
||||
revision = gitilies.id or "HEAD"
|
||||
|
||||
# Initialize git user name to make repo happy.
|
||||
api.crosvm.prepare_git()
|
||||
|
||||
# Init and sync the ChromeOS checkout
|
||||
api.step(
|
||||
"Init repo",
|
||||
|
|
Loading…
Reference in a new issue