Skip to content

Add platform to manifest descriptor in metadata. - #2993

Merged
tonistiigi merged 1 commit into
moby:masterfrom
cpuguy83:metadata_target_platform
Aug 8, 2022
Merged

Add platform to manifest descriptor in metadata.#2993
tonistiigi merged 1 commit into
moby:masterfrom
cpuguy83:metadata_target_platform

Conversation

@cpuguy83

@cpuguy83 cpuguy83 commented Aug 1, 2022

Copy link
Copy Markdown
Member

This just make it simpler to determine the output image's platform.
Today we inject this into the metadata after the build (when we can)
which causes some headache in our build pipelines.

@tonistiigi

Copy link
Copy Markdown
Member

Doesn't this revert #1985 ?

@cpuguy83

cpuguy83 commented Aug 2, 2022

Copy link
Copy Markdown
Member Author

@tonistiigi As far as I can tell, there is no effect except that the descriptor returned includes the platform.
There's no change to the index or manifest at all, no change to results of pushes, no change to filesystem layout when exporting.


var p exptypes.Platforms
if ok {
if err := json.Unmarshal(platformsBytes, &p); err != nil {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This doesn't seem to be backward compatible. The case is when new daemon(exporter) is used with an old frontend that doesn't set this key(because it is not exporting a manifest list).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Would a length check here satisfy this concern? It's already not doing this unmarshal if the metadata is missing entirely.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated to include that, also tested against some already released docker/dockerfile versions as the frontend, seems to be ok.

return errors.Wrapf(err, "failed to marshal build info")
}

p := platforms.DefaultSpec()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not new code but these need Normalize() calls as well.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added.

This just make it simpler to determine the output image's platform.
Today we inject this into the metadata after the build (when we can)
which causes some headache in our build pipelines.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@cpuguy83
cpuguy83 force-pushed the metadata_target_platform branch from 7f9466b to 5d3648d Compare August 8, 2022 22:32
@tonistiigi
tonistiigi merged commit d7788f3 into moby:master Aug 8, 2022
@cpuguy83
cpuguy83 deleted the metadata_target_platform branch August 9, 2022 16:44
emmanuelguerin pushed a commit to emmanuelguerin/buildkit that referenced this pull request Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants