feat: Support zstd compression (#134)

All supported versions of podman, buildah, and docker support the zstd
compression format. This format should allow users to pull less data
when updating their computers.
This commit is contained in:
Gerald Pinder 2024-03-23 17:32:21 -04:00 committed by GitHub
parent da628db1ee
commit dcfdacc518
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 63 additions and 15 deletions

View file

@ -8,7 +8,7 @@ use serde::Deserialize;
use crate::image_metadata::ImageMetadata;
use super::{credentials, BuildDriver, DriverVersion, InspectDriver};
use super::{credentials, opts::CompressionType, BuildDriver, DriverVersion, InspectDriver};
#[derive(Debug, Deserialize)]
struct PodmanVersionJsonClient {
@ -79,9 +79,13 @@ impl BuildDriver for PodmanDriver {
Ok(())
}
fn push(&self, image: &str) -> Result<()> {
fn push(&self, image: &str, compression: CompressionType) -> Result<()> {
trace!("podman push {image}");
let status = Command::new("podman").arg("push").arg(image).status()?;
let status = Command::new("podman")
.arg("push")
.arg(format!("--compression-format={compression}"))
.arg(image)
.status()?;
if status.success() {
info!("Successfully pushed {image}!");