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

Function push_entrypoint

crates/lib/src/image.rs:238–256  ·  view source on GitHub ↗
(
    storage: &Storage,
    host: &Host,
    source: Option<&str>,
    target: Option<&str>,
)

Source from the content-addressed store, hash-verified

236/// Implementation of `bootc image push-to-storage`.
237#[context("Pushing image")]
238pub(crate) async fn push_entrypoint(
239 storage: &Storage,
240 host: &Host,
241 source: Option<&str>,
242 target: Option<&str>,
243) -> Result<()> {
244 let (source, target) = get_imgrefs_for_copy(host, source, target).await?;
245
246 let ostree = storage.get_ostree()?;
247 let repo = &ostree.repo();
248
249 let mut opts = ostree_ext::container::store::ExportToOCIOpts::default();
250 opts.progress_to_stdout = true;
251 println!("Copying local image {source} to {target} ...");
252 let r = ostree_ext::container::store::export(repo, &source, &target, Some(opts)).await?;
253
254 println!("Pushed: {target} {r}");
255 Ok(())
256}
257
258/// Thin wrapper for invoking `podman image <X>` but set up for our internal
259/// image store (as distinct from /var/lib/containers default).

Callers 1

run_from_optFunction · 0.85

Calls 4

get_imgrefs_for_copyFunction · 0.85
get_ostreeMethod · 0.80
exportFunction · 0.70
repoMethod · 0.45

Tested by

no test coverage detected