diff --git a/crates/minimal/src/cmd/project.rs b/crates/minimal/src/cmd/project.rs index ccad410004..3cf6e35392 100644 --- a/crates/minimal/src/cmd/project.rs +++ b/crates/minimal/src/cmd/project.rs @@ -1211,13 +1211,14 @@ pub async fn cmd_add(global: &GlobalArgs, args: AddArgs) -> Result<(), mctx::Err mctx::AddDepMode::SessionPackages, )?; // The host-side add updates `minimal.toml`; unlike the - // in-session helper it does not install into a running session. + // in-box helper it does not install into a running box. // Qualify the success line so it is not read as a live install. eprintln!( - "Note: this updated minimal.toml; a running session is \ - not modified. The package will be present in sessions \ - activated after this change; to add it to an already-running \ - session, run `min add --session` from inside that session." + "Note: this updated minimal.toml. It does not change a \ + running session box. Session boxes that start after this \ + change get the package. To add it to a running box, run \ + `min add --box {}` inside that box.", + args.packages.join(" ") ); } _ => unreachable!(), diff --git a/crates/minimal/src/loadouts.rs b/crates/minimal/src/loadouts.rs index 97d01f676a..a1d7fcd686 100644 --- a/crates/minimal/src/loadouts.rs +++ b/crates/minimal/src/loadouts.rs @@ -179,7 +179,7 @@ description = "orientation banner and shaped prompt" PROMPT_COMMAND = 'eval "$MINIMAL_MOTD"; unset PROMPT_COMMAND MINIMAL_MOTD' PS1 = 'minimal:\w\$ ' MINIMAL_MOTD = ''' -[ -t 1 ] && { printf '\n ████ ████▄\n ▄▄▄ ▀███▄ ▀███▄\n ▀███ ▀███ ▀███\n\n'; printf ' minimal · session %s · loadout %s\n detach: %s' "${MINIMAL_SESSION_NAME:-unnamed}" "${MINIMAL_LOADOUTS:-default (built-in)}" "${MINIMAL_DETACH_HINT:-ctrl-] then d}"; [ -f /workbench/minimal.toml ] || [ -f /workbench/.minimal/minimal.toml ] || printf ' · no minimal.toml here — min init to add one'; printf '\n\n Add tools to this box: min add --session \n Search the registry: min search \n\n'; } +[ -t 1 ] && { printf '\n ████ ████▄\n ▄▄▄ ▀███▄ ▀███▄\n ▀███ ▀███ ▀███\n\n'; printf ' minimal · session %s · loadout %s\n detach: %s' "${MINIMAL_SESSION_NAME:-unnamed}" "${MINIMAL_LOADOUTS:-default (built-in)}" "${MINIMAL_DETACH_HINT:-ctrl-] then d}"; [ -f /workbench/minimal.toml ] || [ -f /workbench/.minimal/minimal.toml ] || printf ' · no minimal.toml here — min init to add one'; printf '\n\n Add tools to this box: min add --box \n Search the registry: min search \n\n'; } ''' "#; @@ -1446,7 +1446,7 @@ on_activate = { type = "inline", value = "sleep 90", timeout = 90 } }) .expect("MINIMAL_MOTD present"); assert!(motd.contains("████"), "the mark stays"); - assert!(motd.contains("min add --session"), "the pointers stay"); + assert!(motd.contains("min add --box"), "the pointers stay"); assert!(motd.contains("${MINIMAL_SESSION_NAME:-")); assert!(motd.contains("${MINIMAL_LOADOUTS:-")); // The blueprint clause tests the session workspace itself at diff --git a/crates/minimald/src/attach_shell.rs b/crates/minimald/src/attach_shell.rs index d55917280e..9b9e2a3f48 100644 --- a/crates/minimald/src/attach_shell.rs +++ b/crates/minimald/src/attach_shell.rs @@ -205,8 +205,8 @@ pub(crate) fn resolve(requested: Option<&str>, rootfs: &Path) -> ShellChoice { // the same directory's `bash`. if !rootfs.join(BIN_DIR).join(shell.binary).exists() { return ShellChoice::bash(Some(format!( - "SHELL names `{requested}`, which is not installed in this session — \ - starting bash instead. Add it with: min add --session {}", + "SHELL names `{requested}`, which is not installed in this box. \ + Starting bash instead. Add it with: min add --box {}", shell.package, ))); } @@ -309,11 +309,11 @@ mod tests { assert_eq!(choice.program, "/usr/bin/bash"); let notice = choice.fallback.expect("an absent shell must be reported"); assert!(notice.contains("/usr/bin/zsh"), "got: {notice}"); - assert!(notice.contains("min add --session zsh"), "got: {notice}"); + assert!(notice.contains("min add --box zsh"), "got: {notice}"); } /// The package name is not always the binary name: nushell installs - /// `nu`, so `min add --session nu` would fail. The notice has to + /// `nu`, so `min add --box nu` would fail. The notice has to /// name the package. #[test] fn the_notice_names_the_package_not_the_binary() { @@ -321,10 +321,7 @@ mod tests { let notice = resolve(Some("nu"), rootfs.path()) .fallback .expect("an absent shell must be reported"); - assert!( - notice.contains("min add --session nushell"), - "got: {notice}" - ); + assert!(notice.contains("min add --box nushell"), "got: {notice}"); } /// Nushell takes no interactive flag — it is interactive when given diff --git a/crates/minimald/src/env.rs b/crates/minimald/src/env.rs index 3396b49c91..2c961c2504 100644 --- a/crates/minimald/src/env.rs +++ b/crates/minimald/src/env.rs @@ -4184,7 +4184,7 @@ exit $rc }; assert_eq!(code, 0, "help should exit 0, got: {stdout} {stderr}"); assert!( - stdout.contains("Usage: min package patched-build "), + stdout.contains("Usage: min package patched-build "), "help should print usage on stdout, got: {stdout}" ); assert!( @@ -4208,7 +4208,7 @@ exit $rc }; assert_eq!(code, 1, "`{args}` should exit 1, got: {stdout} {stderr}"); assert!( - stderr.contains("Usage: min package patched-build "), + stderr.contains("Usage: min package patched-build "), "`{args}` should print usage, got: {stderr}" ); assert!( @@ -4276,60 +4276,75 @@ exit $rc install_min_helpers(rootfs).unwrap(); for (args, code, stream, usage) in [ - ("--help", 0, "stdout", "Usage: min "), - ("-h", 0, "stdout", "Usage: min "), - ("help", 0, "stdout", "Usage: min "), + ("--help", 0, "stdout", "Usage: min [args]"), + ("-h", 0, "stdout", "Usage: min [args]"), + ("help", 0, "stdout", "Usage: min [args]"), ( "package --help", 0, "stdout", - "Usage: min package ", + "Usage: min package [args]", + ), + ( + "package -h", + 0, + "stdout", + "Usage: min package [args]", ), - ("package -h", 0, "stdout", "Usage: min package "), ( "package help", 0, "stdout", - "Usage: min package ", + "Usage: min package [args]", + ), + ( + "pkg --help", + 0, + "stdout", + "Usage: min package [args]", ), - ("pkg --help", 0, "stdout", "Usage: min package "), ( "task --help", 0, "stdout", - "Usage: min task run ", + "Usage: min task [args]", ), - ("net --help", 0, "stdout", "Usage: min net expose "), + ("net --help", 0, "stdout", "Usage: min net [args]"), ( "add --help", 0, "stdout", - "Usage: min add [--session|--build|--runtime] ", + "Usage: min add [--box|--build|--runtime] ...", ), ( "add -h", 0, "stdout", - "Usage: min add [--session|--build|--runtime] ", + "Usage: min add [--box|--build|--runtime] ...", ), ( "add --build --help", 0, "stdout", - "Usage: min add [--session|--build|--runtime] ", + "Usage: min add [--box|--build|--runtime] ...", ), ( "add jq --help", 0, "stdout", - "Usage: min add [--session|--build|--runtime] ", + "Usage: min add [--box|--build|--runtime] ...", + ), + ( + "run --help", + 0, + "stdout", + "Usage: min task run [args]", ), - ("run --help", 0, "stdout", "Usage: min task run "), ( "task run --help", 0, "stdout", - "Usage: min task run ", + "Usage: min task run [args]", ), ( "search --help", @@ -4347,58 +4362,78 @@ exit $rc "package build --help", 0, "stdout", - "Usage: min package build ", + "Usage: min package build [--rebuild] [--verbose] ...", ), ( "package build foo --help", 0, "stdout", - "Usage: min package build ", + "Usage: min package build [--rebuild] [--verbose] ...", ), ( "package patched-build --help", 0, "stdout", - "Usage: min package patched-build ", + "Usage: min package patched-build ", + ), + ( + "check --help", + 0, + "stdout", + "Usage: min check [--fix] [--packages] [--stacks] [...]", + ), + ( + "check foo --help", + 0, + "stdout", + "Usage: min check [--fix] [--packages] [--stacks] [...]", ), - ("check --help", 0, "stdout", "Usage: min check"), - ("check foo --help", 0, "stdout", "Usage: min check"), ( "materialize --help", 0, "stdout", - "Usage: min materialize --output [--arch ] ", + "Usage: min materialize -o [--arch ] ", ), ( "materialize --output x --help", 0, "stdout", - "Usage: min materialize --output [--arch ] ", + "Usage: min materialize -o [--arch ] ", ), ( "materialize --arch x86_64 --help", 0, "stdout", - "Usage: min materialize --output [--arch ] ", + "Usage: min materialize -o [--arch ] ", ), ( "net expose --help", 0, "stdout", - "Usage: min net expose ", + "Usage: min net expose [--public] ", ), - ("package", 1, "stderr", "Usage: min package "), - ("task", 1, "stderr", "Usage: min task run "), - ("net", 1, "stderr", "Usage: min net expose "), - ("bogus", 1, "stderr", "Usage: min "), + ( + "package", + 1, + "stderr", + "Usage: min package [args]", + ), + ("task", 1, "stderr", "Usage: min task [args]"), + ("net", 1, "stderr", "Usage: min net [args]"), + ("bogus", 1, "stderr", "Usage: min [args]"), ( "package bogus", 1, "stderr", - "Usage: min package ", + "Usage: min package [args]", ), - ("task bogus", 1, "stderr", "Usage: min task run "), - ("net bogus", 1, "stderr", "Usage: min net expose "), + ( + "task bogus", + 1, + "stderr", + "Usage: min task [args]", + ), + ("net bogus", 1, "stderr", "Usage: min net [args]"), ] { let Some((stdout, stderr, exit)) = run_min_command(rootfs, args) else { return; @@ -4427,6 +4462,136 @@ exit $rc } } + /// `min --help` opens with the usage line and groups the commands + /// under Packages, Project and Network. Each command's own help ends + /// with an example. None of them contacts the daemon. + #[test] + fn help_is_grouped_and_each_command_has_an_example() { + let tmp = tempfile::tempdir().unwrap(); + let rootfs = tmp.path(); + install_min_helpers(rootfs).unwrap(); + + let Some((stdout, stderr, code)) = run_min_command(rootfs, "--help") else { + return; + }; + assert_eq!(code, 0, "{stdout} {stderr}"); + assert_eq!(stdout.lines().next(), Some("Usage: min [args]")); + for heading in ["Packages:", "Project:", "Network:"] { + assert!( + stdout.lines().any(|l| l == heading), + "no `{heading}` heading in: {stdout}" + ); + } + assert!( + stdout.contains("min pkg, min run and min search are short forms."), + "got: {stdout}" + ); + + for args in [ + "add --help", + "package --help", + "package search --help", + "package build --help", + "package patched-build --help", + "task --help", + "task run --help", + "check --help", + "materialize --help", + "net --help", + "net expose --help", + ] { + let Some((stdout, stderr, code)) = run_min_command(rootfs, args) else { + return; + }; + assert_eq!(code, 0, "`{args}`: {stdout} {stderr}"); + assert!( + stdout.starts_with("Usage: min "), + "`{args}` should open with its usage line, got: {stdout}" + ); + assert!( + stdout.contains("\nExample:\n min "), + "`{args}` should give an example, got: {stdout}" + ); + assert!( + !stderr.contains("RPC-CALLED"), + "`{args}` must not reach the daemon, got: {stderr}" + ); + } + } + + /// `min add --box`, a bare `min add` and `min package add --box` send + /// the `add-session` request, which records the packages in + /// `[defaults.session]`. None of them prints a hint. + #[test] + fn min_add_box_sends_add_session() { + let tmp = tempfile::tempdir().unwrap(); + let rootfs = tmp.path(); + install_min_helpers(rootfs).unwrap(); + + for args in [ + &["add", "--box", "jq", "ripgrep"][..], + &["add", "jq", "ripgrep"][..], + &["package", "add", "--box", "jq", "ripgrep"][..], + ] { + let Some((stdout, stderr, code, request)) = + run_min_against(rootfs, rootfs, args, &[], "done:\n") + else { + return; + }; + assert_eq!(code, 0, "{args:?}: {stdout} {stderr}"); + assert_eq!(request, "add-session%jq ripgrep\n", "{args:?}"); + assert!(stderr.is_empty(), "{args:?} printed: {stderr}"); + } + } + + /// `min add --session` is the 0.8 spelling of `--box`: it sends the + /// same request and prints one line on stderr that names the new + /// spelling with the packages filled in. + #[test] + fn min_add_session_still_works_and_prints_hint() { + let tmp = tempfile::tempdir().unwrap(); + let rootfs = tmp.path(); + install_min_helpers(rootfs).unwrap(); + + let Some((stdout, stderr, code, request)) = run_min_against( + rootfs, + rootfs, + &["add", "--session", "jq", "ripgrep"], + &[], + "done:\n", + ) else { + return; + }; + assert_eq!(code, 0, "{stdout} {stderr}"); + assert_eq!(request, "add-session%jq ripgrep\n"); + assert_eq!( + stderr, + "min add --session is now --box. min add --box jq ripgrep does the same. \ + 0.9 removes --session.\n" + ); + } + + /// An unknown `min add` flag names the three flags and makes no + /// request. + #[test] + fn min_add_unknown_flag_names_box_build_runtime() { + let tmp = tempfile::tempdir().unwrap(); + let rootfs = tmp.path(); + install_min_helpers(rootfs).unwrap(); + + let Some((stdout, stderr, code, request)) = + run_min_against(rootfs, rootfs, &["add", "--bogus", "jq"], &[], "done:\n") + else { + return; + }; + assert_eq!(code, 1, "{stdout} {stderr}"); + assert_eq!( + stderr, + "error: unknown flag '--bogus'. Expected --box, --build or --runtime.\n" + ); + assert!(request.is_empty(), "sent: {request}"); + } + /// Runs the installed `min` helper as a script in `cwd`, with a `socat` /// stand-in that saves the request it reads to a file and answers with /// `reply`. Returns stdout, stderr, the exit code and the saved request, diff --git a/crates/minimald/src/env_min_helper.sh b/crates/minimald/src/env_min_helper.sh index 7c38171e42..8632aebf3a 100644 --- a/crates/minimald/src/env_min_helper.sh +++ b/crates/minimald/src/env_min_helper.sh @@ -59,56 +59,241 @@ __min_materialize_has_help_flag() { return 1 } -# Usage text for the dispatch level named by $1 (default: top). Help +# Help text for the dispatch level named by $1 (default: top). Help # requests print it to stdout and exit 0; error paths print it to stderr. +# It never contacts the daemon. __min_usage() { case "${1:-top}" in top) - echo "Usage: min " - echo "" - echo "Add packages: min add [--session|--build|--runtime] " - echo "Run a task: min task run " - echo "Search for packages: min package search " - echo "Build packages: min package build " - echo "Try building a package (with potentially-stale dependencies): min package patched-build " - echo "Check minimal configuration (bare, by exception): min check" - echo "Materialize an output into the workspace (bare, by exception): min materialize --output [--arch ] " - echo "Publish a port from inside the box: min net expose " + cat <<'EOF' +Usage: min [args] + +The min helper inside a box. Box lifecycle +commands (start, stop, rm) run on the host. + +Packages: + add [--box|--build|--runtime] ... + Install packages and record them in minimal.toml + package search Find packages in the registry + package build ... Build packages from their specs + package patched-build + Rebuild one package against cached dependencies + +Project: + task run [args] Run a task from minimal.toml + check [--fix] Check the packages and stacks + materialize -o [--arch ] + Write a declared output into the workspace + +Network: + net expose Publish a port so the host can reach it + +Run 'min --help' for details. +min pkg, min run and min search are short forms. +EOF ;; package) - echo "Usage: min package " - echo "" - echo "Add packages: min package add [--session|--build|--runtime] " - echo "Search for packages: min package search " - echo "Build packages: min package build " - echo "Try building a package (with potentially-stale dependencies): min package patched-build " + cat <<'EOF' +Usage: min package [args] + +Find, install and build packages. min pkg is the same command. + +Commands: + add [--box|--build|--runtime] ... + Install packages and record them in minimal.toml + search Find packages in the registry + build [--rebuild] [--verbose] ... + Build packages from their specs + patched-build + Rebuild one package against cached dependencies + +Run 'min package --help' for details. + +Example: + min package search ripgrep +EOF ;; - build) - echo "Usage: min package build " + add) + cat <<'EOF' +Usage: min add [--box|--build|--runtime] ... + +Install packages into this box and record them in the box's +minimal.toml. The flag picks where the record goes. With no flag, +min add is min add --box. min package add is the same command. + +Flags: + --box Record the packages in the packages list of + [defaults.session] + --build Record the packages in stack.build_packages + --runtime Record the packages in stack.runtime_packages + -h, --help Print this help + +--session is the 0.8 name of --box. It prints a hint on stderr. +0.9 removes it. + +A package that sets environment variables prints an export line. +Run that line to set the variables in your current shell. + +Example: + min add --box jq +EOF ;; search) - echo "Usage: min package search " + cat <<'EOF' +Usage: min package search + +List up to eight packages whose names are closest to . +min search is the same command. + +Example: + min package search ripgrep +EOF ;; - patched-build) - echo "Usage: min package patched-build " + build) + cat <<'EOF' +Usage: min package build [--rebuild] [--verbose] ... + +Build packages from their specs in a build box. The builds go into +the local cache. A package that a cache already holds is not built +again unless you pass --rebuild. + +Flags: + --rebuild Build the named packages even when a cache holds them + --verbose Print each line of the build logs + -h, --help Print this help + +Example: + min package build --rebuild my-tool +EOF ;; - add) - echo "Usage: min add [--session|--build|--runtime] " + patched-build) + cat <<'EOF' +Usage: min package patched-build + +Build one package against the cached builds of its dependencies. +It does not rebuild those dependencies first. Use it to iterate on +the build of one package. The result goes into the local cache, +apart from the builds that a normal build or install uses. + +Example: + min package patched-build my-tool +EOF ;; task) - echo "Usage: min task run " + cat <<'EOF' +Usage: min task [args] + +Run the tasks that minimal.toml declares. + +Commands: + run [args] Run a task from minimal.toml + +Run 'min task run --help' for details. + +Example: + min task run test +EOF + ;; + run) + cat <<'EOF' +Usage: min task run [args] + +Run a task from minimal.toml in a new box and pass it the arguments. +min run is the same command. The command exits with the task's exit +code. When stdin is a pipe or a file, the task reads it. + +The task gets only the variables that it declares with +{ inherit = true }. A task with inherit_cwd = true starts in the +current directory when that directory is under /workbench. Any +other task starts in /workbench. An interactive task cannot run +from inside a box. Run it on the host. + +Flags: + -h, --help Print this help, when it comes before . After + , --help goes to the task. + +Example: + min task run test --verbose +EOF ;; check) - echo "Usage: min check" + cat <<'EOF' +Usage: min check [--fix] [--packages] [--stacks] [...] + +Check the packages and stacks of this project. With neither +--packages nor --stacks, check both. With names, check only the +packages and stacks whose names match one of them. + +Flags: + --fix Try to fix each issue that the check finds + --packages Check the packages + --stacks Check the stacks + -h, --help Print this help + +Example: + min check --fix +EOF ;; materialize) - echo "Usage: min materialize --output [--arch ] " + cat <<'EOF' +Usage: min materialize -o [--arch ] + +Write the output named to . An [outputs.] +section of minimal.toml declares it. The path must be in the +workspace. + +Flags: + -o, --output The file to write. A relative path is + relative to the current directory. Required. + --arch The architecture to build for, such as amd64 + or arm64. It overrides the arch field in + minimal.toml and the host default. + -h, --help Print this help + +Example: + min materialize -o image.tar --arch arm64 image +EOF ;; net) - echo "Usage: min net expose " + cat <<'EOF' +Usage: min net [args] + +Publish ports of this box. + +Commands: + expose [--public] Publish a port so the host can reach it + +Run 'min net expose --help' for details. + +Example: + min net expose 8080 +EOF ;; expose) - echo "Usage: min net expose " + cat <<'EOF' +Usage: min net expose [--public] + +Ask the host to publish at this box's own address, so the host +can reach it. The box's network.dynamic_ingress setting decides each +request. On the host, the --dynamic-ingress flag of min session start +or min box start sets it. The values are: + allow Publish the port if it is inside the range that the host + flag --dynamic-range sets + ask Ask the person attached to the box + deny Refuse the request. A box with no setting refuses it too. + +The setting applies only to a --network own_ip box. A host_ip box +shares the host's network, so its ports need no expose. A +--network none box refuses the request. + +Flags: + --public Ask to publish the port outside the host. Minimal + refuses it on every host. + -h, --help Print this help + +Example: + min net expose 8080 +EOF ;; esac } @@ -407,9 +592,9 @@ min_add() { return 0 fi - # If no flag provided, or first arg isn't a flag, default to --session + # With no flag, `min add` is `min add --box`. if [[ -z "$flag" || "$flag" != --* ]]; then - flag="--session" + flag="--box" else shift fi @@ -419,13 +604,19 @@ min_add() { return 1 fi + # The daemon's request for --box is named `add-session`. `--session` + # is the 0.8 spelling of --box. local prefix case "$flag" in - --session) prefix="add-session" ;; + --box) prefix="add-session" ;; + --session) + echo "min add --session is now --box. min add --box $* does the same. 0.9 removes --session." >&2 + prefix="add-session" + ;; --build) prefix="add-build" ;; --runtime) prefix="add-runtime" ;; *) - echo "error: unknown flag '$flag'. Expected --session, --build, or --runtime" >&2 + echo "error: unknown flag '$flag'. Expected --box, --build or --runtime." >&2 return 1 ;; esac @@ -435,7 +626,7 @@ min_add() { min_run() { if __min_is_help_flag "$1"; then - __min_usage task + __min_usage run return 0 fi __min_rpc "run" "$(__min_run_request "$@")" diff --git a/docs/reference/sandbox-operations.md b/docs/reference/sandbox-operations.md index 14c46b2648..2dfe8428f9 100644 --- a/docs/reference/sandbox-operations.md +++ b/docs/reference/sandbox-operations.md @@ -14,8 +14,9 @@ is not available inside a sandbox. The helper comes in these forms: - **The `mip run` helper**, in the sandbox of a task that [`mip run`](./cli-mip.md#run) runs, on Linux only. It has fewer commands. -In a box, run `min --help` to print the helper's commands, and add `--help` -to a command to print its usage. The `mip run` helper has no top-level +In a box, run `min --help` to print the helper's commands by group. Add +`--help` to a command to print its usage, its flags and an example. The +`mip run` helper has no top-level `--help`. Run `min` there with no arguments: it prints its commands on stderr and exits 1. @@ -43,14 +44,15 @@ command. | Flag | Description | |------|-------------| -| `--session` | In a box, also add the packages to the `packages` list of `[defaults.session]`. In a `mip run` sandbox, install them without a record | +| `--box` | Box helper only. Also add the packages to the `packages` list of `[defaults.session]` | +| `--session` | In a box, the 0.8 name of `--box`. In a `mip run` sandbox, install the packages without a record | | `--runtime` | Also add the packages to `stack.runtime_packages` | | `--build` | Also add the packages to `stack.build_packages` | | `--task` | `mip run` helper only. Also add the packages to the packages of the task that is running | With no flag, the two helpers do different things: -- In a box, `min add ` is `min add --session `. It installs the +- In a box, `min add ` is `min add --box `. It installs the package and records it in the `packages` list of `[defaults.session]` in the box's `minimal.toml`. A top-level `[session]` table from an older `minimal.toml` moves under `[defaults]` when `min add` writes the file. @@ -58,6 +60,11 @@ With no flag, the two helpers do different things: sandbox only and leaves `minimal.toml` unchanged. It prints a line that says so. +In a box, `min add --session ` still works in 0.8 and does what +`min add --box ` does. It first prints a line on stderr that names +`min add --box` with the same packages. 0.9 removes `--session` from the +box helper. + A package that sets environment variables prints an `export` line. Run it to apply the variables in your current shell. @@ -120,6 +127,11 @@ error. Box helper only. Builds the packages in a clean room. The builds go into the local cache. The `mip run` helper refuses the command. +| Flag | Description | +|------|-------------| +| `--rebuild` | Build the named packages even when a cache holds them | +| `--verbose` | Print each line of the build logs | + A build that you ask for inside a box runs in a build box. Its reach depends on where the package comes from. A box that does not admit the network refuses a project package that needs the network. See diff --git a/scripts/session-e2e.sh b/scripts/session-e2e.sh index 8ba7681da5..5ad6bbaa5e 100755 --- a/scripts/session-e2e.sh +++ b/scripts/session-e2e.sh @@ -8743,7 +8743,7 @@ exit' python3 "$ROOT/scripts/e2e-attach-pty.py" - \ echo "--- transcript ---"; printf '%s\n' "$miss_out" fail fi - if [[ "$miss_out" != *"min add --session zsh"* ]]; then + if [[ "$miss_out" != *"min add --box zsh"* ]]; then echo "::error::the fallback notice did not reach the terminal" echo "--- transcript ---"; printf '%s\n' "$miss_out" fail @@ -24432,7 +24432,7 @@ proof_a_build_box_fetches_its_source() { # host-side boot log. The attempt never reads the server's SSH banner # either way. # -# * the build leg (NET-155): `min add --session` of a project-local +# * the build leg (NET-155): `min add --box` of a project-local # package whose one web source is a literal address in TEST-NET-2. The # box's rules admit no destination, so the fetch opens no connection. # The build fails, its error names the destination and the box's rules, @@ -24792,18 +24792,18 @@ attempt=vsock CID $ebr_cid port 2222 refusal=refused at the guest daemon's accep # this leg must not see could not appear. Wait it out, as the escape leg does. echo "waiting 61 s for the gate's per-source line window for $ebr_node to close" sleep 61 - EBR_EXPECTED="'min add --session $ebr_pkg' fails inside the box, its error names $ebr_build_dst and the egress rules of box e2e-ebr, and the gate writes no line for $ebr_build_dst" + EBR_EXPECTED="'min add --box $ebr_pkg' fails inside the box, its error names $ebr_build_dst and the egress rules of box e2e-ebr, and the gate writes no line for $ebr_build_dst" ebr_prior="$(ebr_gate_lines "$ebr_node" egress-node-plane-unpinned "$ebr_build_dst" | wc -l)" # shellcheck disable=SC2016 # `$?` must reach the box's shell unexpanded. ebr_out="$(mnl box exec "$ebr_sid" -- \ - bash -c "timeout 300 min add --session $ebr_pkg 2>&1; echo min-add-exit=\$?" \ + bash -c "timeout 300 min add --box $ebr_pkg 2>&1; echo min-add-exit=\$?" \ 2>"$WORK/ebr-build.err")" || { - echo "::error::the in-box 'min add --session $ebr_pkg' could not run" + echo "::error::the in-box 'min add --box $ebr_pkg' could not run" cat "$WORK/ebr-build.err" 2>/dev/null || true ebr_fail } ebr_out="$(printf '%s\n' "$ebr_out" | tr -d '\r')" - echo "attempt: 'min add --session $ebr_pkg' inside the deny-all box (web source https://$ebr_build_dst/):" + echo "attempt: 'min add --box $ebr_pkg' inside the deny-all box (web source https://$ebr_build_dst/):" printf '%s\n' "$ebr_out" | tail -n 20 | sed 's/^/ /' ebr_rc="$(printf '%s\n' "$ebr_out" | sed -n 's/^min-add-exit=//p' | tail -n1)" if [ -z "$ebr_rc" ] || [ "$ebr_rc" = 0 ]; then