Skip to content

Commit

Permalink
copy/single: honor c.options.DestCtx for regular copy
Browse files Browse the repository at this point in the history
If its a regular copy callers might not set `compressionFormat` and
`compressionLevel` in such case still honor compression which is set in
DestinationCtx from copier.

Signed-off-by: Aditya R <arajan@redhat.com>
  • Loading branch information
flouthoc committed Jul 21, 2023
1 parent fdff65a commit 067a67d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion copy/single.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,13 @@ func (c *copier) copySingleImage(ctx context.Context, unparsedImage *image.Unpar
cannotModifyManifestReason: cannotModifyManifestReason,
requireCompressionFormatMatch: opts.requireCompressionFormatMatch,
}
if c.options.DestinationCtx != nil {
if opts.compressionFormat != nil {
// Note that compressionFormat and compressionLevel can be nil.
ic.compressionFormat = opts.compressionFormat
ic.compressionLevel = opts.compressionLevel
} else if c.options.DestinationCtx != nil {
ic.compressionFormat = c.options.DestinationCtx.CompressionFormat
ic.compressionLevel = c.options.DestinationCtx.CompressionLevel
}
// Decide whether we can substitute blobs with semantic equivalents:
// - Don’t do that if we can’t modify the manifest at all
Expand Down

0 comments on commit 067a67d

Please sign in to comment.