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

DO NOT MERGE: Run tests with Zstd compression default #21571

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

Conversation

mtrmac
Copy link
Collaborator

@mtrmac mtrmac commented Feb 8, 2024

Inspired by #20633

Does this PR introduce a user-facing change?

do not merge this

@openshift-ci openshift-ci bot added release-note do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Feb 8, 2024
Copy link
Contributor

openshift-ci bot commented Feb 8, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mtrmac

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 8, 2024
@mtrmac
Copy link
Collaborator Author

mtrmac commented Feb 8, 2024

Legitimate problems:

  • podman … push --format=v2s2 … fails with Error: compression using zstd required together with format application/vnd.docker.distribution.manifest.v2+json, which does not support it. Arguably an explicit option on the CLI should override config-file compression defaults, the intent here is clear.
  • podman … push … docker-archive:… fails with compression using zstd required but the destination only supports MIME types [application/vnd.docker.distribution.manifest.v2+json], none of which support it. Same as above, but there isn’t even an explicit CLI option.

@mtrmac
Copy link
Collaborator Author

mtrmac commented Feb 8, 2024

@giuseppe FYI. I’ll continue investigating this, just noting the Podman-side UI concerns above for now.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 10, 2024
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 12, 2024
Copy link

Ephemeral COPR build failed. @containers/packit-build please check.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 12, 2024
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 13, 2024
Copy link

Cockpit tests failed for commit 9ce62ea83c221979aff1bd91afe0c002cc73f270. @martinpitt, @jelly, @mvollmer please check.

Copy link

Cockpit tests failed for commit 1a9566f043cf084167e5ef3e8e90a1690dc7bead. @martinpitt, @jelly, @mvollmer please check.

@giuseppe
Copy link
Member

CI is green!

@@ -371,7 +371,7 @@ var _ = Describe("Podman push", func() {
It("podman push to docker-archive", func() {
SkipIfRemote("Remote push does not support docker-archive transport")
tarfn := filepath.Join(podmanTest.TempDir, "alp.tar")
session := podmanTest.Podman([]string{"push", "-q", ALPINE,
session := podmanTest.Podman([]string{"push", "-q", ALPINE, "--compression-format=gzip",
Copy link
Member

Choose a reason for hiding this comment

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

Does this require a change in podman or contianers/image?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is specific to containers.conf. So not c/image; Podman or maybe c/common/libimage.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 21, 2024
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 22, 2024
@mtrmac
Copy link
Collaborator Author

mtrmac commented Feb 22, 2024

🎉 green!

#21793 now contains the test updates we do want to make; the other changes from this PR should not be merged, and instead we should change Podman’s behavior.

@rhatdan
Copy link
Member

rhatdan commented Feb 27, 2024

@mtrmac needs a rebase, since latest containers/image is now in podman.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 28, 2024
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 28, 2024
@rhatdan
Copy link
Member

rhatdan commented Feb 28, 2024

Any suggestion on how to fix
UNWANTED: Don't assume that (podman manifest push) doesn't modify images

We want to fix this test and then merge in common, then we can say zstd is supported.

Is it time to test zstd:chunked and see if it passes this test?

@mtrmac
Copy link
Collaborator Author

mtrmac commented Feb 28, 2024

Any suggestion on how to fix UNWANTED: Don't assume that (podman manifest push) doesn't modify images

I think replacing the checks for specific SHA256 values with checks that all those architectures are present would keep the spirit of that test.


Is it time to test zstd:chunked and see if it passes this test?

*shrug* the checklist still contains unresolved issues I’m working on. Triggering a test run now, to see what else might be outstanding, can’t hurt.

@rhatdan
Copy link
Member

rhatdan commented Feb 29, 2024

@giuseppe can you update the test above so we can remove it from this list.

@giuseppe
Copy link
Member

giuseppe commented Feb 29, 2024

@mtrmac would something like the following work for you?

diff --git a/test/e2e/manifest_test.go b/test/e2e/manifest_test.go
index 3a05c4f5c..01249e726 100644
--- a/test/e2e/manifest_test.go
+++ b/test/e2e/manifest_test.go
@@ -2,6 +2,8 @@ package integration
 
 import (
 	"encoding/json"
+	"fmt"
+	"io/ioutil"
 	"os"
 	"path/filepath"
 	"strings"
@@ -16,6 +18,50 @@ import (
 	imgspecv1 "github.com/opencontainers/image-spec/specs-go/v1"
 )
 
+// validateManifestHasAllArchs checks that the specified manifest has all
+// the archs in `imageListInstance`
+func validateManifestHasAllArchs(path string) error {
+	data, err := ioutil.ReadFile(path)
+	if err != nil {
+		return err
+	}
+
+	var result map[string]interface{}
+	if err := json.Unmarshal(data, &result); err != nil {
+		return err
+	}
+
+	manifests, ok := result["manifests"].([]interface{})
+	if !ok {
+		return fmt.Errorf("invalid manifest file")
+	}
+	archs := map[string]bool{
+		"amd64":   false,
+		"arm64":   false,
+		"ppc64le": false,
+		"s390x":   false,
+	}
+	for _, manifestItem := range manifests {
+		manifest := manifestItem.(map[string]interface{})
+		platform, ok := manifest["platform"].(map[string]interface{})
+		if !ok {
+			continue
+		}
+
+		if arch, ok := platform["architecture"].(string); ok {
+			if _, exists := archs[arch]; exists {
+				archs[arch] = true
+			}
+		}
+	}
+	for arch, present := range archs {
+		if !present {
+			return fmt.Errorf("architecture %q is missing in the manifest", arch)
+		}
+	}
+	return nil
+}
+
 // Internal function to verify instance compression
 func verifyInstanceCompression(descriptor []imgspecv1.Descriptor, compression string, arch string) bool {
 	for _, instance := range descriptor {
@@ -415,23 +461,12 @@ add_compression = ["zstd"]`), 0o644)
 		defer func() {
 			os.RemoveAll(dest)
 		}()
		session = podmanTest.Podman([]string{"manifest", "push", "-q", "--all", "foo", "dir:" + dest})
 		session.WaitWithDefaultTimeout()
 		Expect(session).Should(ExitCleanly())
 
-		files, err := filepath.Glob(dest + string(os.PathSeparator) + "*")
-		Expect(err).ShouldNot(HaveOccurred())
-		check := SystemExec("sha256sum", files)
-		check.WaitWithDefaultTimeout()
-		Expect(check).Should(ExitCleanly())
-		prefix := "sha256:"
-		Expect(check.OutputToString()).To(
-			And(
-				ContainSubstring(strings.TrimPrefix(imageListAMD64InstanceDigest, prefix)),
-				ContainSubstring(strings.TrimPrefix(imageListPPC64LEInstanceDigest, prefix)),
-				ContainSubstring(strings.TrimPrefix(imageListS390XInstanceDigest, prefix)),
-				ContainSubstring(strings.TrimPrefix(imageListARM64InstanceDigest, prefix)),
-			))
+		err = validateManifestHasAllArchs(filepath.Join(dest, "manifest.json"))
+		Expect(err).ToNot(HaveOccurred())
 	})
 
 	It("push", func() {
@@ -451,20 +486,9 @@ add_compression = ["zstd"]`), 0o644)
 		session = podmanTest.Podman([]string{"push", "-q", "foo", "dir:" + dest})
 		session.WaitWithDefaultTimeout()
 		Expect(session).Should(ExitCleanly())
-		files, err := filepath.Glob(dest + string(os.PathSeparator) + "*")
-		Expect(err).ToNot(HaveOccurred())
-		check := SystemExec("sha256sum", files)
-		check.WaitWithDefaultTimeout()
-		Expect(check).Should(ExitCleanly())
 
-		prefix := "sha256:"
-		Expect(check.OutputToString()).To(
-			And(
-				ContainSubstring(strings.TrimPrefix(imageListAMD64InstanceDigest, prefix)),
-				ContainSubstring(strings.TrimPrefix(imageListPPC64LEInstanceDigest, prefix)),
-				ContainSubstring(strings.TrimPrefix(imageListS390XInstanceDigest, prefix)),
-				ContainSubstring(strings.TrimPrefix(imageListARM64InstanceDigest, prefix)),
-			))
+		err = validateManifestHasAllArchs(filepath.Join(dest, "manifest.json"))
+		Expect(err).ToNot(HaveOccurred())
 	})
 
 	It("push with compression-format and compression-level", func() {

@giuseppe
Copy link
Member

opened a PR: #21878

@rhatdan
Copy link
Member

rhatdan commented Feb 29, 2024

Should be able to remove first and last PRs from this main PR. Which means zstd passes, now lets test zstd:chunked and start working through those issues.

@mtrmac
Copy link
Collaborator Author

mtrmac commented Mar 1, 2024

Yes, this PR is now a pure setting change to test behavior with Zstd.

I have separately filed #21903 for testing zstd:chunked .

@rhatdan
Copy link
Member

rhatdan commented Mar 1, 2024

Nice work @mtrmac and @giuseppe

@mtrmac
Copy link
Collaborator Author

mtrmac commented Mar 1, 2024

For the record, 7879d59 is all green, with no Podman changes (other than the compression algorithm).

@rhatdan
Copy link
Member

rhatdan commented Mar 1, 2024

Yup now we need to ship podman 5.0 and change rawhide to zstd:chunked by default.

@mtrmac mtrmac force-pushed the try-zstd-default branch from 7879d59 to cda5994 Compare April 3, 2024 16:21
@mtrmac mtrmac force-pushed the try-zstd-default branch from cda5994 to 8f7a624 Compare July 17, 2024 17:40
@mtrmac mtrmac force-pushed the try-zstd-default branch 3 times, most recently from 2529e6e to 9312529 Compare November 28, 2024 20:56
@mtrmac mtrmac force-pushed the try-zstd-default branch 2 times, most recently from eb921cd to 1810e21 Compare December 12, 2024 23:58
The Go image is too old, at least in the CI images

Signed-off-by: Miloslav Trmač <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants