Skip to content

Commit f2326bd

Browse files
authored
fix: set compression format in manifest_push (#645)
The `--compression-format` option had been getting ignored by the podman and buildah drivers when calling `manifest_push`. Fixes #648.
1 parent d22bc98 commit f2326bd

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

process/drivers/buildah_driver.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@ impl BuildDriver for BuildahDriver {
310310
"manifest",
311311
"push",
312312
"--all",
313+
if let Some(compression_fmt) = opts.compression_type => format!(
314+
"--compression-format={compression_fmt}"
315+
),
313316
image,
314317
format!("docker://{}", opts.final_image),
315318
);

process/drivers/opts/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ pub struct ManifestCreateOpts<'scope> {
9898
pub struct ManifestPushOpts<'scope> {
9999
/// The final image to push.
100100
pub final_image: &'scope Reference,
101+
102+
/// Compression format to use when pushing images in manifest.
103+
pub compression_type: Option<CompressionType>,
101104
}
102105

103106
/// Options for building, tagging, and pushing images.

process/drivers/podman_driver.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,9 @@ impl BuildDriver for PodmanDriver {
396396
"podman",
397397
"manifest",
398398
"push",
399+
if let Some(compression_fmt) = opts.compression_type => format!(
400+
"--compression-format={compression_fmt}"
401+
),
399402
image,
400403
format!("docker://{}", opts.final_image),
401404
);
@@ -471,6 +474,9 @@ impl BuildChunkedOciDriver for PodmanDriver {
471474
for args,
472475
"push",
473476
if let Some(authfile) = runner.authfile() => ["--authfile", authfile],
477+
if let Some(compression_fmt) = opts.compression_type => format!(
478+
"--compression-format={compression_fmt}"
479+
),
474480
image,
475481
format!("docker://{}", opts.final_image),
476482
);

process/drivers/traits.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ pub trait BuildDriver: PrivateDriver {
237237
Self::manifest_push(
238238
ManifestPushOpts::builder()
239239
.final_image(&tagged_image)
240+
.compression_type(opts.compression)
240241
.build(),
241242
)
242243
})?;
@@ -555,13 +556,15 @@ pub trait BuildChunkedOciDriver: BuildDriver + RunDriver {
555556
&runner,
556557
ManifestPushOpts::builder()
557558
.final_image(&tagged_image)
559+
.compression_type(btp_opts.compression)
558560
.build(),
559561
)
560562
.and_then(|()| {
561563
Self::manifest_push_with_runner(
562564
&runner,
563565
ManifestPushOpts::builder()
564566
.final_image(&tagged_image)
567+
.compression_type(btp_opts.compression)
565568
.build(),
566569
)
567570
})

0 commit comments

Comments
 (0)