Skip to content

Commit 83a6a15

Browse files
committed
cli: Rename to image copy-to-storage
Drop the transport support; we only support copying to `containers-storage`. Anyone who wants to push directly to a remote registry can do so by first copying to containers-storage and then pushing via e.g. `podman` or `skopeo`. Signed-off-by: Colin Walters <[email protected]>
1 parent 6033b1e commit 83a6a15

File tree

3 files changed

+10
-35
lines changed

3 files changed

+10
-35
lines changed

lib/src/cli.rs

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -199,25 +199,13 @@ pub(crate) enum ImageOpts {
199199
///
200200
/// Note that these are distinct from images stored via e.g. `podman`.
201201
List,
202-
/// Copy a container image from the bootc storage to a target.
203-
///
204-
/// ## Copying the booted container image to containers-storage: (podman)
202+
/// Copy a container image from the bootc storage to `containers-storage:`.
205203
///
206204
/// The source and target are both optional; if both are left unspecified,
207-
/// via a simple invocation of `bootc image push`, then the default is to
205+
/// via a simple invocation of `bootc image copy-to-storage`, then the default is to
208206
/// push the currently booted image to `containers-storage` (as used by podman, etc.)
209207
/// and tagged with the image name `localhost/bootc`,
210208
///
211-
/// ## Copying the booted container image to a remote registry
212-
///
213-
/// Aside from the special case above, default transport is `registry`. This
214-
/// means that an invocation of
215-
///
216-
/// `bootc image push --target quay.io/example/someimage:latest` will push the
217-
/// booted container image to the target registry. This will be done via an
218-
/// invocation equivalent to `skopeo copy`, and hence the defaults for that apply.
219-
/// For example, the default registry authentication file applies.
220-
///
221209
/// ## Copying a non-default container image
222210
///
223211
/// It is also possible to copy an image other than the currently booted one by
@@ -227,13 +215,7 @@ pub(crate) enum ImageOpts {
227215
///
228216
/// At the current time there is no explicit support for pulling images other than indirectly
229217
/// via e.g. `bootc switch` or `bootc upgrade`.
230-
Push {
231-
/// The transport; e.g. oci, oci-archive, containers-storage. Defaults to `registry`.
232-
///
233-
/// For more information, see `man containers-transports`.
234-
#[clap(long, default_value = "registry")]
235-
transport: String,
236-
218+
CopyToStorage {
237219
#[clap(long)]
238220
/// The source image; if not specified, the booted image will be used.
239221
source: Option<String>,
@@ -794,13 +776,8 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
794776
},
795777
Opt::Image(opts) => match opts {
796778
ImageOpts::List => crate::image::list_entrypoint().await,
797-
ImageOpts::Push {
798-
transport,
799-
source,
800-
target,
801-
} => {
802-
let transport = Transport::try_from(transport.as_str())?;
803-
crate::image::push_entrypoint(transport, source.as_deref(), target.as_deref()).await
779+
ImageOpts::CopyToStorage { source, target } => {
780+
crate::image::push_entrypoint(source.as_deref(), target.as_deref()).await
804781
}
805782
},
806783
#[cfg(feature = "install")]

lib/src/image.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@ pub(crate) async fn list_entrypoint() -> Result<()> {
2222
Ok(())
2323
}
2424

25+
/// Implementation of `bootc image push-to-storage`.
2526
#[context("Pushing image")]
26-
pub(crate) async fn push_entrypoint(
27-
transport: Transport,
28-
source: Option<&str>,
29-
target: Option<&str>,
30-
) -> Result<()> {
27+
pub(crate) async fn push_entrypoint(source: Option<&str>, target: Option<&str>) -> Result<()> {
28+
let transport = Transport::ContainerStorage;
3129
let sysroot = crate::cli::get_locked_sysroot().await?;
3230

3331
let repo = &sysroot.repo();

tests/booted/002-test-image-pushpull-upgrade.nu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# This test does:
2-
# bootc image push
2+
# bootc image copy-to-storage
33
# podman build <from that image>
44
# bootc switch <to the local image>
55
# <verify booted state>
@@ -32,7 +32,7 @@ def initial_build [] {
3232
cd $td
3333

3434
do --ignore-errors { podman image rm localhost/bootc o+e>| ignore }
35-
bootc image push
35+
bootc image copy-to-storage
3636
let img = podman image inspect localhost/bootc | from json
3737

3838
mkdir usr/lib/bootc/kargs.d

0 commit comments

Comments
 (0)