mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-25 05:03:05 +00:00
dev_container: Add --no-interactive option
This flag is used by luci builders to force non-interactive mode. The logic is temporary to allow us to change the defaults for the interactive mode / tty logic in a follow-up CL. BUG=b:275613273 TEST=dev_container --no-interactive run_tests Change-Id: I93f315d5f65ed184e9c400531b115cc94312c95f Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4818789 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Commit-Queue: Dennis Kempin <denniskempin@google.com>
This commit is contained in:
parent
d1a43064eb
commit
baf1937010
9 changed files with 28 additions and 10 deletions
|
@ -60,7 +60,7 @@ Usage:
|
|||
|
||||
  **@property**<br>— **def [dev\_container\_cache](/infra/recipe_modules/crosvm/api.py#39)(self):**
|
||||
|
||||
— **def [get\_git\_sha](/infra/recipe_modules/crosvm/api.py#185)(self):**
|
||||
— **def [get\_git\_sha](/infra/recipe_modules/crosvm/api.py#186)(self):**
|
||||
|
||||
— **def [host\_build\_context](/infra/recipe_modules/crosvm/api.py#113)(self):**
|
||||
|
||||
|
@ -77,7 +77,7 @@ Usage:
|
|||
|
||||
Directory used to install local tools required by the build.
|
||||
|
||||
— **def [prepare\_git](/infra/recipe_modules/crosvm/api.py#160)(self):**
|
||||
— **def [prepare\_git](/infra/recipe_modules/crosvm/api.py#161)(self):**
|
||||
|
||||
  **@property**<br>— **def [rustup\_home](/infra/recipe_modules/crosvm/api.py#19)(self):**
|
||||
|
||||
|
@ -97,7 +97,7 @@ Where the crosvm source will be checked out.
|
|||
|
||||
Runs a luci step inside the crosvm dev container.
|
||||
|
||||
— **def [upload\_coverage](/infra/recipe_modules/crosvm/api.py#193)(self, filename):**
|
||||
— **def [upload\_coverage](/infra/recipe_modules/crosvm/api.py#194)(self, filename):**
|
||||
## Recipes
|
||||
|
||||
### *recipes* / [build\_chromeos\_hatch](/infra/recipes/build_chromeos_hatch.py)
|
||||
|
|
|
@ -150,6 +150,7 @@ class CrosvmApi(recipe_api.RecipeApi):
|
|||
[
|
||||
"vpython3",
|
||||
self.source_dir.join("tools/dev_container"),
|
||||
"--no-interactive",
|
||||
"--verbose",
|
||||
]
|
||||
+ (["--cros"] if cros else [])
|
||||
|
|
|
@ -257,6 +257,7 @@
|
|||
"cmd": [
|
||||
"vpython3",
|
||||
"[CACHE]/builder/crosvm/tools/dev_container",
|
||||
"--no-interactive",
|
||||
"--verbose",
|
||||
"true"
|
||||
],
|
||||
|
@ -271,6 +272,7 @@
|
|||
"cmd": [
|
||||
"vpython3",
|
||||
"[CACHE]/builder/crosvm/tools/dev_container",
|
||||
"--no-interactive",
|
||||
"--verbose",
|
||||
"cargo",
|
||||
"build"
|
||||
|
|
|
@ -250,6 +250,7 @@
|
|||
"cmd": [
|
||||
"vpython3",
|
||||
"[CACHE]/builder/crosvm/tools/dev_container",
|
||||
"--no-interactive",
|
||||
"--verbose",
|
||||
"--cros",
|
||||
"true"
|
||||
|
@ -264,6 +265,7 @@
|
|||
"cmd": [
|
||||
"vpython3",
|
||||
"[CACHE]/builder/crosvm/tools/dev_container",
|
||||
"--no-interactive",
|
||||
"--verbose",
|
||||
"--cros",
|
||||
"true"
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"cmd": [
|
||||
"vpython3",
|
||||
"[CACHE]/builder/crosvm/tools/dev_container",
|
||||
"--no-interactive",
|
||||
"--verbose",
|
||||
"--cros",
|
||||
"cros_sdk",
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"cmd": [
|
||||
"vpython3",
|
||||
"[CACHE]/builder/crosvm/tools/dev_container",
|
||||
"--no-interactive",
|
||||
"--verbose",
|
||||
"mdbook",
|
||||
"build",
|
||||
|
@ -32,6 +33,7 @@
|
|||
"cmd": [
|
||||
"vpython3",
|
||||
"[CACHE]/builder/crosvm/tools/dev_container",
|
||||
"--no-interactive",
|
||||
"--verbose",
|
||||
"./tools/cargo-doc",
|
||||
"--target-dir",
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
"cmd": [
|
||||
"vpython3",
|
||||
"[CACHE]/builder/crosvm/tools/dev_container",
|
||||
"--no-interactive",
|
||||
"--verbose",
|
||||
"tools/presubmit",
|
||||
"--no-delta",
|
||||
|
@ -55,6 +56,7 @@
|
|||
"cmd": [
|
||||
"vpython3",
|
||||
"[CACHE]/builder/crosvm/tools/dev_container",
|
||||
"--no-interactive",
|
||||
"--verbose",
|
||||
"tools/presubmit",
|
||||
"--no-delta",
|
||||
|
@ -86,6 +88,7 @@
|
|||
"cmd": [
|
||||
"vpython3",
|
||||
"[CACHE]/builder/crosvm/tools/dev_container",
|
||||
"--no-interactive",
|
||||
"--verbose",
|
||||
"./tools/build_release",
|
||||
"--json",
|
||||
|
@ -121,6 +124,7 @@
|
|||
"cmd": [
|
||||
"vpython3",
|
||||
"[CACHE]/builder/crosvm/tools/dev_container",
|
||||
"--no-interactive",
|
||||
"--verbose",
|
||||
"./tools/infra/binary_size",
|
||||
"--builder-name",
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
"cmd": [
|
||||
"vpython3",
|
||||
"[CACHE]/builder/crosvm/tools/dev_container",
|
||||
"--no-interactive",
|
||||
"--verbose",
|
||||
"tools/presubmit",
|
||||
"--no-delta",
|
||||
|
@ -55,6 +56,7 @@
|
|||
"cmd": [
|
||||
"vpython3",
|
||||
"[CACHE]/builder/crosvm/tools/dev_container",
|
||||
"--no-interactive",
|
||||
"--verbose",
|
||||
"tools/presubmit",
|
||||
"--no-delta",
|
||||
|
|
|
@ -201,6 +201,7 @@ def main(argv: List[str]):
|
|||
parser.add_argument("--clean", action="store_true")
|
||||
parser.add_argument("--hermetic", action="store_true")
|
||||
parser.add_argument("--interactive", action="store_true")
|
||||
parser.add_argument("--no-interactive", action="store_true")
|
||||
parser.add_argument("--use-docker", action="store_true")
|
||||
parser.add_argument("--self-test", action="store_true")
|
||||
parser.add_argument("--pull", action="store_true")
|
||||
|
@ -277,13 +278,16 @@ def main(argv: List[str]):
|
|||
|
||||
# If a command is provided run non-interactive unless explicitly asked for.
|
||||
tty_args = []
|
||||
if not command or args.interactive:
|
||||
if not sys.stdin.isatty():
|
||||
raise Exception("Trying to run an interactive session in a non-interactive terminal.")
|
||||
tty_args = ["--interactive", "--tty"]
|
||||
elif sys.stdin.isatty():
|
||||
# Even if run non-interactively, we do want to pass along a tty for proper output.
|
||||
tty_args = ["--tty"]
|
||||
if not args.no_interactive:
|
||||
if not command or args.interactive:
|
||||
if not sys.stdin.isatty():
|
||||
raise Exception(
|
||||
"Trying to run an interactive session in a non-interactive terminal."
|
||||
)
|
||||
tty_args = ["--interactive", "--tty"]
|
||||
elif sys.stdin.isatty():
|
||||
# Even if run non-interactively, we do want to pass along a tty for proper output.
|
||||
tty_args = ["--tty"]
|
||||
|
||||
# Start an interactive shell by default
|
||||
if args.hermetic:
|
||||
|
|
Loading…
Reference in a new issue