Skip to content

[22.06 backport] Update uses of Image platform fields in OCI image-spec#44126

Merged
thaJeztah merged 1 commit intomoby:22.06from
thaJeztah:22.06_backport_image_spec_no_literal
Sep 22, 2022
Merged

[22.06 backport] Update uses of Image platform fields in OCI image-spec#44126
thaJeztah merged 1 commit intomoby:22.06from
thaJeztah:22.06_backport_image_spec_no_literal

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

The OCI image spec is considering to change the Image struct and embedding the Platform type (see opencontainers/image-spec#959) in the go implementation. Moby currently uses some struct-literals to propagate the platform fields, which will break once those changes in the OCI spec are merged.

Ideally (once that change arrives) we would update the code to set the Platform information as a whole, instead of assigning related fields individually, but in some cases in the code, image platform information is only partially set (for example, OSVersion and OSFeatures are not preserved in all cases). This may be on purpose, so needs to be reviewed.

This patch keeps the current behavior (assigning only specific fields), but removes the use of struct-literals to make the code compatible with the upcoming changes in the image-spec module.

(cherry picked from commit 3cb933d)

The OCI image spec is considering to change the Image struct and embedding the
Platform type (see opencontainers/image-spec#959) in the go implementation.
Moby currently uses some struct-literals to propagate the platform fields,
which will break once those changes in the OCI spec are merged.

Ideally (once that change arrives) we would update the code to set the Platform
information as a whole, instead of assigning related fields individually, but
in some cases in the code, image platform information is only partially set
(for example, OSVersion and OSFeatures are not preserved in all cases). This
may be on purpose, so needs to be reviewed.

This patch keeps the current behavior (assigning only specific fields), but
removes the use of struct-literals to make the code compatible with the
upcoming changes in the image-spec module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 3cb933d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah
Copy link
Copy Markdown
Member Author

One test looks flaky; opened a ticket #44128

=== FAIL: amd64.integration-cli TestDockerCLIRunSuite/TestRunAttachDetachFromInvalidFlag (0.85s)
    docker_cli_run_unix_test.go:233: read |0: file already closed
    --- FAIL: TestDockerCLIRunSuite/TestRunAttachDetachFromInvalidFlag (0.85s)

@thaJeztah thaJeztah marked this pull request as ready for review September 22, 2022 13:16
@thaJeztah
Copy link
Copy Markdown
Member Author

@neersighted @cpuguy83 PTAL (forgot I had this one still in draft)

@thaJeztah thaJeztah merged commit aca9143 into moby:22.06 Sep 22, 2022
@thaJeztah thaJeztah deleted the 22.06_backport_image_spec_no_literal branch September 22, 2022 17:01
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