Skip to content
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

Add a test for forcing compression and v2s2 format #24673

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Jamstah
Copy link

@Jamstah Jamstah commented Nov 25, 2024

This highlights a bug in common where the compression format is reset if the format is v2s2, even if its a valid compression format.

Does this PR introduce a user-facing change?

None

@openshift-ci openshift-ci bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none labels Nov 25, 2024
@Jamstah Jamstah force-pushed the allow-forced-gzip-on-v2s2 branch 2 times, most recently from ccf7160 to 71c9623 Compare November 25, 2024 17:32
Copy link
Contributor

openshift-ci bot commented Nov 25, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Jamstah
Once this PR has been reviewed and has the lgtm label, please assign tomsweeneyredhat for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @mtrmac

skopeo.WaitWithDefaultTimeout()
Expect(skopeo).Should(ExitCleanly())
output := skopeo.OutputToString()
Expect(output).ToNot(ContainSubstring("zstd"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should check for the proper gzip mime type I would assume? Checking for not zstd does not mean it cannot be any other incorrect value.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this was copied from the --force-compression test, where actually its testing that without force it doesn't recompress existing layers.

Fixed to check for the presence of gzip instead.


push = podmanTest.Podman([]string{"push", "-q", "--tls-verify=false", "--force-compression=true", "--compression-format", "zstd", "--format", "v2s2", "--remove-signatures", "imageone", "localhost:5005/image"})
push.WaitWithDefaultTimeout()
Expect(push).Should(ExitWithError(125, "cannot use ForceCompressionFormat with undefined default compression format"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error seems extremely unhelpful. Why undefined default compression format? The command clearly specified zstd as format so this makes just no sense.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's just testing that the change to common doesn't mean that other invalid cases will still be attempted.

The fix to common is only to allow it to work in the gzip case, not to fix the misleading error completely.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is all a fallout of the c/common code being a short-term hack (where we didn’t do the long-term correct thing), see containers/common#1869 .

What we want is to differentiate between compression formats coming from containers.conf (which should be silently ignored for destinations which can’t support them, silently falling back to gzip) and compression formats coming from the command line (which should cause an error when the user asks for an impossible operation).

But the podman CLI (here

flags.StringVar(&pushOptions.CompressionFormat, compFormat, compressionFormat(), "compression format to use")
) is in the habit of using the containers.conf values as CLI option defaults, making it, from the very start, hard to tell the difference (although, IIRC, possible). And by the time the data gets to c/common, there is no longer any way to tell, in the current c/common API.


I do think that a comment here, in the test case, to the effect of “the command is asking for an impossible thing; per containers/common#1869, we should detect that and fail with a precise error, but that does not exist, so we end up reporting this misleading text” would be useful.

This highlights a bug in common where the compression format is reset if the format is v2s2, even if its a valid compression format.

Signed-off-by: James Hewitt <[email protected]>
Copy link

Cockpit tests failed for commit 6871b47. @martinpitt, @jelly, @mvollmer please check.

Copy link

Cockpit tests failed for commit 5563a32. @martinpitt, @jelly, @mvollmer please check.

@martinpitt
Copy link
Contributor

Wrt. failed cockpit rawhide test: I reported the criu/kernel regression to https://bugzilla.redhat.com/show_bug.cgi?id=2328985 and silenced it in our tests in cockpit-project/bots#7146 . From now on, this failure will be ignored, i.e. tests should go back to green. Please either retry or re-push.

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! ACK to the goal and overall approach.

test/e2e/push_test.go Show resolved Hide resolved

push = podmanTest.Podman([]string{"push", "-q", "--tls-verify=false", "--force-compression=true", "--compression-format", "zstd", "--format", "v2s2", "--remove-signatures", "imageone", "localhost:5005/image"})
push.WaitWithDefaultTimeout()
Expect(push).Should(ExitWithError(125, "cannot use ForceCompressionFormat with undefined default compression format"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is all a fallout of the c/common code being a short-term hack (where we didn’t do the long-term correct thing), see containers/common#1869 .

What we want is to differentiate between compression formats coming from containers.conf (which should be silently ignored for destinations which can’t support them, silently falling back to gzip) and compression formats coming from the command line (which should cause an error when the user asks for an impossible operation).

But the podman CLI (here

flags.StringVar(&pushOptions.CompressionFormat, compFormat, compressionFormat(), "compression format to use")
) is in the habit of using the containers.conf values as CLI option defaults, making it, from the very start, hard to tell the difference (although, IIRC, possible). And by the time the data gets to c/common, there is no longer any way to tell, in the current c/common API.


I do think that a comment here, in the test case, to the effect of “the command is asking for an impossible thing; per containers/common#1869, we should detect that and fail with a precise error, but that does not exist, so we end up reporting this misleading text” would be useful.

@mtrmac
Copy link
Collaborator

mtrmac commented Nov 26, 2024

For the record, this PR exists to test containers/common#2255 .

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 27, 2024
@openshift-merge-robot
Copy link
Collaborator

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note-none
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants