diff --git a/infra/README.recipes.md b/infra/README.recipes.md index 30278c238c..51610edd46 100644 --- a/infra/README.recipes.md +++ b/infra/README.recipes.md @@ -60,7 +60,7 @@ Usage:   **@property**
— **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**
— **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) diff --git a/infra/recipe_modules/crosvm/api.py b/infra/recipe_modules/crosvm/api.py index d241b39015..7308a19aa3 100644 --- a/infra/recipe_modules/crosvm/api.py +++ b/infra/recipe_modules/crosvm/api.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 []) diff --git a/infra/recipe_modules/crosvm/examples/container_build_context.expected/basic.json b/infra/recipe_modules/crosvm/examples/container_build_context.expected/basic.json index 328bdb2de6..c7860d97b8 100644 --- a/infra/recipe_modules/crosvm/examples/container_build_context.expected/basic.json +++ b/infra/recipe_modules/crosvm/examples/container_build_context.expected/basic.json @@ -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" diff --git a/infra/recipe_modules/crosvm/examples/cros_container_build_context.expected/basic.json b/infra/recipe_modules/crosvm/examples/cros_container_build_context.expected/basic.json index ae227695ac..448392dfed 100644 --- a/infra/recipe_modules/crosvm/examples/cros_container_build_context.expected/basic.json +++ b/infra/recipe_modules/crosvm/examples/cros_container_build_context.expected/basic.json @@ -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" diff --git a/infra/recipes/build_chromeos_hatch.expected/build_chromeos_hatch.json b/infra/recipes/build_chromeos_hatch.expected/build_chromeos_hatch.json index 4fdf44f954..4bdfc75a59 100644 --- a/infra/recipes/build_chromeos_hatch.expected/build_chromeos_hatch.json +++ b/infra/recipes/build_chromeos_hatch.expected/build_chromeos_hatch.json @@ -3,6 +3,7 @@ "cmd": [ "vpython3", "[CACHE]/builder/crosvm/tools/dev_container", + "--no-interactive", "--verbose", "--cros", "cros_sdk", diff --git a/infra/recipes/build_docs.expected/build_docs.json b/infra/recipes/build_docs.expected/build_docs.json index 66c2ba4105..7ed945ccb6 100644 --- a/infra/recipes/build_docs.expected/build_docs.json +++ b/infra/recipes/build_docs.expected/build_docs.json @@ -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", diff --git a/infra/recipes/build_linux.expected/build_x86_64.json b/infra/recipes/build_linux.expected/build_x86_64.json index ae41c3341a..6499425e41 100644 --- a/infra/recipes/build_linux.expected/build_x86_64.json +++ b/infra/recipes/build_linux.expected/build_x86_64.json @@ -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", diff --git a/infra/recipes/health_check.expected/basic.json b/infra/recipes/health_check.expected/basic.json index e20f4b6b25..827eb031f0 100644 --- a/infra/recipes/health_check.expected/basic.json +++ b/infra/recipes/health_check.expected/basic.json @@ -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", diff --git a/tools/dev_container b/tools/dev_container index cb532bc0f1..5be214af4f 100755 --- a/tools/dev_container +++ b/tools/dev_container @@ -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: