-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
manifest, push: implement --add-compression
to push with compressed variants.
#19468
manifest, push: implement --add-compression
to push with compressed variants.
#19468
Conversation
Needs: containers/common#1590 (review) |
d738d08
to
ffbf32e
Compare
Suspecting issues due to some change in |
ffbf32e
to
7c64566
Compare
@containers/podman-maintainers PTAL PR is similar to containers/buildah#4912 |
@mtrmac PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Podman maintainers, please take a look as well — I think I have a general understanding but there are certainly aspects of the engine / remote API design that I’m missing.
Makes sure that requested compression variant for each platform is added to the manifest list keeping original instance | ||
intact in the same manifest list. Supported values are (`gzip`, `zstd` and `zstd:chunked`) | ||
|
||
Note: This is different than `--compression` which replaces the instance with requested with specified compression |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That option is named --compression-format
in Podman.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just extend --compression to be a comma separated list.
--compression gzip,zstd
I think that makes for a better User UI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now the two have quite different semantics, as the text above says.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why you say that.
If I say --compression gzip, then it is going to push the image if it has gzip compression or change the compression to gzip if it was something else.
If I push --compression gzip,zstd then I would figure it is going to push gzip and zstd, even if the original was something different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rhatdan We have already used --add-compression
since it was overlapping with --compression
on buildah side, it will be good here for consistency.
Extending --compression
changes functionality for example --compression gzip
will replace instances , but --compression gzip,zstd
will only replace gzip
and add zstd
while changing the order of input will change functionality entirely consider --compression zstd,gzip
it will replace zstd
and add gzip
.
We had a prior discussion here: containers/common#1585
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existing --compress
prefers to reuse blobs, even if they don’t use the expected algorithm. That’s a long-standing behavior and I wouldn’t be surprised if users by now relied on it.
(It’s not necessarily the option semantics we would design now as the default, if we were building the CLI from scratch with the feature set of the underlying codebase as of today, but I think the years of past practice change the calculation. @flouthoc is already working on making it possible to force using the requested algorithm independently from the cloning functionality, but that’s not this PR.)
b9dc2aa
to
9f64ac9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks close to done to me.
At this point I’ll need to defer to actual Podman experts — please review independently.
9f64ac9
to
1363a56
Compare
Signed-off-by: Aditya R <[email protected]>
1363a56
to
3e2d9ca
Compare
Rebased. @containers/podman-maintainers PTAL |
if ! type -p skopeo; then | ||
skip "skopeo not available" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to my knowledge skopeo is a hard requirement so this skip makes no sense
cc @edsantiago
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests which are using skopeo
have this check directly or indirectly so I have added it here as well.
if ! type -p skopeo; then | ||
skip "skopeo not available" | ||
fi | ||
skip_if_remote "running a local registry doesn't work with podman-remote" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? Not having remote tests is a big issue. We need tests to cover remote client and API as well.
If we cannot set this up in system tests we should use e2e tests or the bindings and API tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a e2e
test.
7828753
to
22b1661
Compare
@containers/podman-maintainers PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely non-blocking tentative suggestions — don’t let me slow down this work unnecessarily.
// 4 images must be pushed two for gzip and two for zstd | ||
Expect(output).To(ContainSubstring("Copying 4 images generated from 2 images in list")) | ||
|
||
session = podmanTest.Podman([]string{"run", "--rm", "--net", "host", "quay.io/skopeo/stable", "inspect", "--tls-verify=false", "--raw", "docker://localhost:5000/list:latest"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely non-blocking: This could plausibly call c/image instead of using a subprocess.
OTOH this is easier to follow for people unfamiliar with that codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is similar to systems test for easier review and familiarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would make more sense to directly execute skopeo on the host instead of pulling the image as pull are flaky and slow. We already depend on it in system test so I see no problem using it in e2e as well.
session = podmanTest.Podman([]string{"build", "--platform", "linux/amd64", "-t", "imageone", "build/basicalpine"}) | ||
session.WaitWithDefaultTimeout() | ||
Expect(session).Should(Exit(0)) | ||
|
||
session = podmanTest.Podman([]string{"build", "--platform", "linux/arm64", "-t", "imagetwo", "build/basicalpine"}) | ||
session.WaitWithDefaultTimeout() | ||
Expect(session).Should(Exit(0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have multi-arch image that could be used for this test without requiring a build, by any chance?
(I have no idea … and if this works, maybe we can spend CPU cycles instead of our attention.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quay.io/libpod/20221018
? Or even :00000004
if you want a tiny image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure I'll consider it if I am going to make any further change and repush this. ( I hope this not a hard blocker since OTOH building image makes tests independent of any external image ( pulling ) which has been encouraged in past if i can recall )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC the Podman e2e tests already have some infrastructure to pre-pull / cache images, so that not every pull needs to reach out to the internet. But I don’t know the details by heart.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, tests can be improved later if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last nit on the docs
intact in the same manifest list. Supported values are (`gzip`, `zstd` and `zstd:chunked`) | ||
|
||
Note: This is different than `--compression-format` which replaces the instance with requested with specified compression | ||
while `--add-compression` makes sure than each instance has it variant added to manifest list without modifying the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason I cannot propose a change via the GitHub UI but the sentence above has typos:
makes sure that each instance has its variant added to manifest list without modifying the
original instance.
I still find the note hard to understand and suggest to be more explicit and less abstract:
"Note that --compression-format
controls the compression format of each instance in the manifest list. --add-compression
will add another variant for each instance in the list with the specified compressions. --compression-format gzip --add-compression zstd
will push a manifest list with each instance being compressed with gzip plus an additional variant of each instance being compressed with zstd."
I am sure there's a better description than mine but I find it important to be more explicit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe worth mentioning that it can be specified multiple times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe worth mentioning that it can be specified multiple times.
Amended text and added above line as well.
07b7e22
to
9509e1a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/hold
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: flouthoc, Luap99, vrothberg The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Adds support for --add-compression which accepts multiple compression formats and when used it will add all instances in a manifest list with requested compression formats. Signed-off-by: Aditya R <[email protected]>
9509e1a
to
346f9cb
Compare
/lgtm |
/hold cancel |
This is a feature PR for containers/image feature merged in below PR:
TryReusingBlobWithOptions
considerRequiredCompression
if set image#2023instanceCopyClone
forzstd
compression image#1987ListUpdate
addimgspecv1.Platform
field image#2029Adds a new flag --add-compression to manifest push, which when added will push existing manifest on host while replicating the instances with required compression.
Similar implementation to: containers/buildah#4912