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

Improve Container support for AOT publishing and targeting musl runtimes. #37054

Merged
merged 6 commits into from
Dec 18, 2023

Conversation

baronfel
Copy link
Member

@baronfel baronfel commented Nov 20, 2023

Fixes dotnet/sdk-container-builds#524
Fixes dotnet/sdk-container-builds#301

This PR moves the inference logic that used to be in the targets directly into a task because the logic was getting too gnarly. We now check a number of signals about the project to determine the

  • repository
  • version tag portion (i.e. 8.0)
  • variant tag portion (i.e. alpine-aot)
    required to infer the base image the project should use.

The decision tree looks very similar to before:

  • explicit user ContainerBaseImage skips this process entirely
  • otherwise inference occurs:
    • the TFM and SDK version are used to determine which version tag should be selected (this logic didn't change at all)
    • the kind of project is investigated to choose between the aspnet, runtime, runtime-deps, and nightly/runtime-deps (for aot/extras scenarios) repositories
      • TODO: add tests that verify for .NET 7 and below none of the nightly/aot/extra images are selected
    • the target RID is investigated to see if we should be using -alpine variants of these images
    • the AOT capabilities and globalization states are investigated to determine if the -aot or -extras variants of the image should be used

The first commit is a refactoring of our tests that used a local registry run inside a Docker container. Recent versions of Docker for Windows have introduced validation that prevent pushing a manifest list tag (i.e. the 6.0 base image tag that contains N image variants for that tag) unless the entire manifest's tags are present in that container. Since we do not test or cover that use case, I slightly refactored the tests to make it easy to just push up the single variants we use.

This works around an issue with recent Docker CLI push calls that prevented
pushing partial manifests to another registry. Because we were
pushing a single, arch-specific manifest for our tests, the Docker CLI didn't
like pushing the entire manifest.
@baronfel baronfel requested a review from a team as a code owner November 20, 2023 20:40
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Containers Related to dotnet SDK containers functionality untriaged Request triage from a team member labels Nov 20, 2023
@baronfel
Copy link
Member Author

I added a bunch of tests that should clarify the expected behaviors here with regards to image and tag selection:

  • MuslRidsGetAlpineContainers
  • AOTAppsGetAOTImages
  • AOTAppsWithCulturesGetExtraImages
  • AOTAppsLessThan8DoNotGetAOTImages
  • AOTAppsLessThan8WithCulturesDoNotGetExtraImages

@baronfel baronfel enabled auto-merge December 18, 2023 15:27
@baronfel baronfel merged commit 7cf2fba into dotnet:release/8.0.2xx Dec 18, 2023
16 checks passed
@baronfel baronfel deleted the better-sdk-aot-defaults branch January 3, 2024 18:43
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 untriaged Request triage from a team member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants