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

Introduce annotation sanity checks #3283

Merged
merged 3 commits into from
Nov 16, 2022

Conversation

jedevc
Copy link
Member

@jedevc jedevc commented Nov 14, 2022

🛠️ Fixes #3277, by preventing confusion around what functionality is supported.

This PR resolves two issues with annotation attachment, where inputs will be accepted even if they are not used - we should explicitly error in these cases.

  1. Index + Index descriptor annotations are not supported for single platform builds produced by the Dockerfile so we should explicitly error (@tonistiigi, should we have a user accessible way to force this? We can the FrontendAttrs["multi-platform"] key, but could we also expose a build-arg? Automatically detecting annotations like attestations and using ForceRefsProcessor is possible but kind of ugly here, since we'd have to parse exporter options before doing a solve).
  2. Valid platforms that are part of annotations but are not built as part of the resulting image cannot be included and so should explicitly error.

@jedevc jedevc added this to the v0.11.0 milestone Nov 14, 2022
@crazy-max crazy-max closed this Nov 14, 2022
@crazy-max crazy-max reopened this Nov 14, 2022
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.

Would be good if we could detect this before running the whole build.

@jedevc
Copy link
Member Author

jedevc commented Nov 15, 2022

Would be good if we could detect this before running the whole build.

Agreed - unfortunately, I don't think there's a whole lot we can do before. It's not known before a build whether a frontend will produce a single Ref or multiple Refs (e.g. a single platform might produce a map of one ref, or just a ref), so we can't know whether we'll generate a manifest or an index before we run the build.

The frontend itself can also add annotations to the map, so we don't even know all the annotations to add to the image, though if we could get around the above, then we could just check the user-provided annotations at the beginning, and then check the frontend-provided annotations at the same point as the PR currently does.

This moves the fallback to enable oci media types from the exporter into
the writer, similar to attestations. This prevents us needing to have an
explicit AddAnnotations function for the options, so we can remove that
too.

Signed-off-by: Justin Chadwell <me@jedevc.com>
…t export

Signed-off-by: Justin Chadwell <me@jedevc.com>
…atform

Signed-off-by: Justin Chadwell <me@jedevc.com>
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.

Annotations not working as expected to add descriptions
3 participants