MCPcopy Create free account
hub / github.com/bootc-dev/bootc / builder_from_image

Function builder_from_image

crates/tests-integration/src/runvm.rs:40–58  ·  view source on GitHub ↗
(sh: &Shell, cimage: &str)

Source from the content-addressed store, hash-verified

38}
39
40fn builder_from_image(sh: &Shell, cimage: &str) -> Result<String> {
41 let mut inspect: serde_json::Value =
42 serde_json::from_str(&cmd!(sh, "podman inspect --type image {cimage}").read()?)?;
43 let inspect = inspect
44 .as_array_mut()
45 .and_then(|v| v.pop())
46 .ok_or_else(|| anyhow::anyhow!("Failed to parse inspect output"))?;
47 let config = inspect
48 .get("Config")
49 .ok_or_else(|| anyhow::anyhow!("Missing config"))?;
50 let config: oci_spec::image::Config =
51 serde_json::from_value(config.clone()).context("Parsing config")?;
52 let builder = config
53 .labels()
54 .as_ref()
55 .and_then(|l| l.get(BUILDER_ANNOTATION))
56 .ok_or_else(|| anyhow::anyhow!("Missing {BUILDER_ANNOTATION}"))?;
57 Ok(builder.to_owned())
58}
59
60#[context("Running bootc-image-builder")]
61fn run_bib(sh: &Shell, cimage: &str, tmpdir: &Utf8Path, diskpath: &Utf8Path) -> Result<()> {

Callers 1

run_bibFunction · 0.85

Calls 2

readMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected