Skip to content

exporter/containerimage: default to oci-mediatypes=true #6095

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

neersighted
Copy link
Member

The change to provenance-by-default implicitly changed the default mediaTypes to OCI, but an explicit --provenance=false negates this and causes surprising behavior.

To fix this, we make the explicit default oci-mediatypes=true and make oci-mediatypes=false fail for incompatible cases.

Addresses #6094.

Tests are needed/missing; I've had some issues getting the tests working locally and skipped them for now.

This helper has not been used for some time.

Signed-off-by: Bjorn Neergaard <[email protected]>
To facilitate this change, we now fail when there is an exporter option
conflict instead of implicitly setting oci-mediatypes=true.

Signed-off-by: Bjorn Neergaard <[email protected]>
This matches the documentation, which never specified behavior for
empty/unknown (non-boolean) strings.

We can also remove the parseBoolWithDefault helper, as this was the last
consumer.

Signed-off-by: Bjorn Neergaard <[email protected]>
@@ -77,6 +77,7 @@ func (e *imageExporter) Resolve(ctx context.Context, id int, opt map[string]stri
RefCfg: cacheconfig.RefConfig{
Compression: compression.New(compression.Default),
},
OCITypes: true,
Copy link
Member

Choose a reason for hiding this comment

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

Should we start considering changing the defaults in code? (Have a "DisableOCITypes" boolean, and start sunsetting the "OCITypes" bool)?

Copy link
Member Author

Choose a reason for hiding this comment

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

We discussed this a bit; @tonistiigi expressed a preference for keeping the exporter as-is for now, and just initializing the instance with the modified default.

@neersighted neersighted changed the title exporter/containerimage: default to oci-mediatype=true exporter/containerimage: default to oci-mediatypes=true Jul 18, 2025
Copy link
Member

@tonistiigi tonistiigi left a comment

Choose a reason for hiding this comment

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

@neersighted Check the CI errors. Some tests expecting different mediatype and linter.

@@ -49,7 +48,7 @@ func (c *ImageCommitOpts) Load(ctx context.Context, opt map[string]string) (map[
case exptypes.OptKeyName:
c.ImageName = v
case exptypes.OptKeyOCITypes:
err = parseBoolWithDefault(&c.OCITypes, k, v, true)
Copy link
Member

Choose a reason for hiding this comment

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

Not handling the empty value in here seems like possibly breaking change. Don't remember the history behind it but maybe don't break it as it seems harmeless.

Copy link
Member Author

Choose a reason for hiding this comment

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

That change was made for the other types that originally used this parsing function, so based on that I'm relatively confident in/in favor of this change.

When support for zstd was introduced, these mediaTypes were not yet
available in released versions of their respective Go packages. That is
no longer the case.

Signed-off-by: Bjorn Neergaard <[email protected]>
@neersighted
Copy link
Member Author

neersighted commented Jul 18, 2025

Check the CI errors. Some tests expecting different mediatype and linter.

Yeah, I'm having issues getting the tests to run locally on arm64 due to platform mismatches in the Dockerfile linter tests throwing up a LOT of noise.

A lot of tests have implicit assumptions about this behavior, and I will work through them and make them pass (and add a regression test to ensure this behavior is as intended in the future) once I have a little more time to review the CI runs.

Unless you have some tips on how to get the tests suite to pass (on master) locally on an arm64 mac?

@neersighted
Copy link
Member Author

Just leaving a note that I still mean to get back to this and get the tests added/passing; but I've been having to deal with other concerns at work, and I'll be off for a few days. I'm going to block out some time to get this over the finish line when I get back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants