wick_oci_utils/
push.rs

1use oci_distribution::client::{Config, ImageLayer, PushResponse};
2use oci_distribution::manifest::{self};
3use oci_distribution::secrets::RegistryAuth;
4use oci_distribution::{Client, Reference};
5
6use crate::error::OciError;
7
8pub async fn push(
9  client: &mut Client,
10  auth: &RegistryAuth,
11  reference: &Reference,
12  layers: &[ImageLayer],
13) -> Result<PushResponse, OciError> {
14  let config = Config::new(b"{}".to_vec(), manifest::IMAGE_CONFIG_MEDIA_TYPE.to_owned(), None);
15
16  client
17    .push(reference, layers, config, auth, None)
18    .await
19    .map_err(|e| OciError::OciPushFailure(reference.clone(), e.into()))
20}