diff --git a/lib/src/cli.rs b/lib/src/cli.rs index e193049b9..adda0ddfb 100644 --- a/lib/src/cli.rs +++ b/lib/src/cli.rs @@ -199,25 +199,13 @@ pub(crate) enum ImageOpts { /// /// Note that these are distinct from images stored via e.g. `podman`. List, - /// Copy a container image from the bootc storage to a target. - /// - /// ## Copying the booted container image to containers-storage: (podman) + /// Copy a container image from the bootc storage to `containers-storage:`. /// /// The source and target are both optional; if both are left unspecified, - /// via a simple invocation of `bootc image push`, then the default is to + /// via a simple invocation of `bootc image push-to-storage`, then the default is to /// push the currently booted image to `containers-storage` (as used by podman, etc.) /// and tagged with the image name `localhost/bootc`, /// - /// ## Copying the booted container image to a remote registry - /// - /// Aside from the special case above, default transport is `registry`. This - /// means that an invocation of - /// - /// `bootc image push --target quay.io/example/someimage:latest` will push the - /// booted container image to the target registry. This will be done via an - /// invocation equivalent to `skopeo copy`, and hence the defaults for that apply. - /// For example, the default registry authentication file applies. - /// /// ## Copying a non-default container image /// /// It is also possible to copy an image other than the currently booted one by @@ -227,13 +215,7 @@ pub(crate) enum ImageOpts { /// /// At the current time there is no explicit support for pulling images other than indirectly /// via e.g. `bootc switch` or `bootc upgrade`. - Push { - /// The transport; e.g. oci, oci-archive, containers-storage. Defaults to `registry`. - /// - /// For more information, see `man containers-transports`. - #[clap(long, default_value = "registry")] - transport: String, - + PushToStorage { #[clap(long)] /// The source image; if not specified, the booted image will be used. source: Option, @@ -794,13 +776,8 @@ async fn run_from_opt(opt: Opt) -> Result<()> { }, Opt::Image(opts) => match opts { ImageOpts::List => crate::image::list_entrypoint().await, - ImageOpts::Push { - transport, - source, - target, - } => { - let transport = Transport::try_from(transport.as_str())?; - crate::image::push_entrypoint(transport, source.as_deref(), target.as_deref()).await + ImageOpts::PushToStorage { source, target } => { + crate::image::push_entrypoint(source.as_deref(), target.as_deref()).await } }, #[cfg(feature = "install")] diff --git a/lib/src/image.rs b/lib/src/image.rs index d79ed6056..4fd7cd9b1 100644 --- a/lib/src/image.rs +++ b/lib/src/image.rs @@ -22,12 +22,10 @@ pub(crate) async fn list_entrypoint() -> Result<()> { Ok(()) } +/// Implementation of `bootc image push-to-storage`. #[context("Pushing image")] -pub(crate) async fn push_entrypoint( - transport: Transport, - source: Option<&str>, - target: Option<&str>, -) -> Result<()> { +pub(crate) async fn push_entrypoint(source: Option<&str>, target: Option<&str>) -> Result<()> { + let transport = Transport::ContainerStorage; let sysroot = crate::cli::get_locked_sysroot().await?; let repo = &sysroot.repo(); diff --git a/tests/booted/002-test-image-pushpull-upgrade.nu b/tests/booted/002-test-image-pushpull-upgrade.nu index f73ccc663..e5b8c40dc 100644 --- a/tests/booted/002-test-image-pushpull-upgrade.nu +++ b/tests/booted/002-test-image-pushpull-upgrade.nu @@ -1,5 +1,5 @@ # This test does: -# bootc image push +# bootc image push-to-storage # podman build # bootc switch # @@ -32,7 +32,7 @@ def initial_build [] { cd $td do --ignore-errors { podman image rm localhost/bootc o+e>| ignore } - bootc image push + bootc image push-to-storage let img = podman image inspect localhost/bootc | from json mkdir usr/lib/bootc/kargs.d