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

Support publishing of multi-architecture OCI container images #43085

Open
wants to merge 106 commits into
base: release/8.0.4xx
Choose a base branch
from

Conversation

surayya-MS
Copy link
Member

@surayya-MS surayya-MS commented Aug 29, 2024

The changes in this PR:

  1. PublishContainer target renamed to _PublishSingleContainer
  2. New _PublishMultiArchContainers target that calls _PublishSingleContainer for each arch and then creates image index
  3. PublishContainer target calls either _PublishSingleContainer or _PublishMultiArchContainers depending on a condition
  4. Implemented new task CreateImageIndex that creates the image index (manifest list it's same thing) and pushes to the remote registry.

Notes:

  • For docker in order to create manifest list (image index) the images must be available in the remote registry. For podman it is possible to do it locally. That is not part of these PR. It will be the next iteration.
  • Another thing that needs to be done is reordering of targets and trying to call _PublishSingleContainer target in parallel
  • Unit tests

Testing:
Tested manually for docker hub registry, linux-x64 and linux-arm64 architectures

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Containers Related to dotnet SDK containers functionality untriaged Request triage from a team member labels Aug 29, 2024
@surayya-MS surayya-MS removed the untriaged Request triage from a team member label Aug 29, 2024
@baronfel
Copy link
Member

baronfel commented Sep 3, 2024

A few notes that we will need to handle based on my trials at baronfel/sdk-container-demo#15

  • The ContainerRepository property is only inferred for single-RID scenarios, not multi-RID so the CreateImageIndex task crashes.
    • We should be able to infer this property similarly to how we infer it for the single-RID publishes
  • ContainerImageTags needs to be supported for the inner builds - when ContainerImageTags is specified we get crashes on the single-image Publishes because the single-image publishes unconditionally forward along a single tag.
    • Instead of always forcing a single ContainerImageTag, we should append the RID to each ContainerImageTags value if specified
    • The CreateImageIndex Task should also accept ContainerImageTags similar to the single-image push
  • Using the package is rough right now - the in-SDK checks complain at you. In addition, if you have both the SDK and the package the SDK's Import always overrides the package. I had to work around this here
    • We should set the _ContainersTargetsDir property to point to the containers package path in the package .props so that users don't have to do all of this
    • We should add a Code to the Containers-checking target to allow users to suppress this warning - we can steal the code from my older PR: Add code to containers check to allow users to silence it #42501
  • CreateImageIndex crashes when no container registry is specified, often because a local publish was done
    • we should add a Condition that skips CreateImageIndex when local daemon publish was requested

@KalleOlaviNiemitalo
Copy link

PublishContainer target calls either _PublishSingleContainer or _PublishSingleContainer depending on a condition

Or _PublishMultiArchContainers.

@surayya-MS
Copy link
Member Author

  1. Added unit and integration tests
  2. Fixed passing env variables, ports and labels in multi-arch scenario

@surayya-MS surayya-MS marked this pull request as ready for review November 11, 2024 15:40
@surayya-MS surayya-MS requested a review from a team as a code owner November 11, 2024 15:40
@baronfel baronfel changed the title [DO NOT MERGE] Multi arch containers Support publishing of multi-architecture OCI container images Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Containers Related to dotnet SDK containers functionality DO NOT MERGE
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants