Skip to content

Commit b664ecb

Browse files
committed
ephemeral: Add an option to override the entrypoint
The goal is to make it easier to debug entrypoint failures as one can do e.g. ``` $ bcvk ephemeral run -ti --debug-entrypoint bash -K --name mytestvm2 quay.io/fedora/fedora-bootc:42 ``` (And also e.g. interactively inspect the state of the container before bwrap and qemu is launched etc.) Signed-off-by: Colin Walters <[email protected]>
1 parent 5709b13 commit b664ecb

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

crates/kit/src/run_ephemeral.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,11 @@ pub struct RunEphemeralOpts {
240240
#[clap(flatten)]
241241
pub podman: CommonPodmanOptions,
242242

243+
/// Do not run the default entrypoint directly, but
244+
/// instead invoke the provided command (e.g. `bash`).
245+
#[clap(long)]
246+
pub debug_entrypoint: Option<String>,
247+
243248
#[clap(
244249
long = "bind",
245250
value_name = "HOST_PATH[:NAME]",
@@ -524,7 +529,8 @@ fn prepare_run_command_with_temp(
524529
cmd.args(["-e", &format!("BOOTC_DISK_FILES={}", disk_specs)]);
525530
}
526531

527-
cmd.args([&opts.image, ENTRYPOINT]);
532+
let entrypoint = opts.debug_entrypoint.as_deref().unwrap_or(ENTRYPOINT);
533+
cmd.args([&opts.image, entrypoint]);
528534

529535
Ok((cmd, td))
530536
}

crates/kit/src/to_disk.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ pub fn run(opts: ToDiskOpts) -> Result<()> {
453453
opts.additional.format.as_str()
454454
)], // Attach target disk
455455
kernel_args: Default::default(),
456+
debug_entrypoint: None,
456457
};
457458

458459
// Phase 5: SSH-based VM configuration and execution

docs/src/man/bcvk-ephemeral-run-ssh.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ Run ephemeral VM and SSH into it
8989

9090
Set environment variables in the container (key=value)
9191

92+
**--debug-entrypoint**=*DEBUG_ENTRYPOINT*
93+
94+
Do not run the default entrypoint directly, but instead invoke the provided command (e.g. `bash`)
95+
9296
**--bind**=*HOST_PATH[:NAME]*
9397

9498
Bind mount host directory (RW) at /run/virtiofs-mnt-<name>

docs/src/man/bcvk-ephemeral-run.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ This design allows bcvk to provide VM-like isolation and boot behavior while lev
115115

116116
Set environment variables in the container (key=value)
117117

118+
**--debug-entrypoint**=*DEBUG_ENTRYPOINT*
119+
120+
Do not run the default entrypoint directly, but instead invoke the provided command (e.g. `bash`)
121+
118122
**--bind**=*HOST_PATH[:NAME]*
119123

120124
Bind mount host directory (RW) at /run/virtiofs-mnt-<name>

0 commit comments

Comments
 (0)