Skip to content

Fix distroless test helper using the wrong registry for the full runtime-deps image - #7496

Merged
lbussell merged 1 commit into
nightlyfrom
lbussell/distroless-test-parent-fix-nightly
Nov 13, 2026
Merged

lbussell merged 1 commit into
nightlyfrom
lbussell/distroless-test-parent-fix-nightly

Conversation

@lbussell

Copy link
Copy Markdown
Member

The distroless image tests fail whenever a build includes a distroless image but not its full runtime-deps parent. This happens because distroless and full images are built on different base images that can update independently. This bug was dormant until Azure Linux 4 started updating distroless images more independently from the full base images. The tests fail with:

ERROR: <staging-registry>/build-staging/<build-id>/dotnet/runtime-deps:11.0-azurelinux4.0-amd64: not found

In the tests, BuildDistrolessHelper needs the full runtime-deps image as the base for its helper image. It got that name in the wrong order:

  1. It resolved the name of the distroless runtime-deps image, for example runtime-deps:11.0-azurelinux4.0-distroless-amd64.
  2. GetImage picks the registry in that same step, by checking whether that exact tag is in this build's image info. The distroless image was built, so it chose the staging registry.
  3. The helper then removed -distroless from the resulting string.

The tag now pointed at the full image, but in the staging repo instead of from mcr.microsoft.com. That choice was only valid for the distroless image. If the full image wasn't rebuilt in the same build, it was never pushed to staging, and the tests failed. It only worked when the full image happened to be rebuilt too.

This PR resolves the image name using the full OS (IsDistroless = false) from the start, so the registry check looks at the full image's own tag. When the full image isn't part of the build, the existing fallback uses the published image on mcr.microsoft.com, which is fine because the full image is only used to provide a shell for inspecting the copied distroless filesystem. When the full image is part of the build, staging is still used. This also covers Ubuntu chiseled images and the nightly repo.

BuildDistrolessHelper resolved the runtime-deps image name (including the registry) using the distroless tag, then stripped -distroless/-chiseled from the result. When a build only produced the distroless image, this pointed at the staging registry for a full image that was never pushed. Resolve the name using the distro-full OS so the registry falls back to MCR when the full image isn't part of the build.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@lbussell
lbussell requested a review from a team as a code owner November 13, 2026 17:55
@lbussell
lbussell enabled auto-merge (squash) November 13, 2026 18:43
@lbussell
lbussell merged commit 4c7fdf7 into nightly Nov 13, 2026
131 checks passed
@github-actions github-actions Bot added the needs-backport PR that should be backported to another branch label Nov 13, 2026
@lbussell

Copy link
Copy Markdown
Member Author

/backport to main

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to main (link to workflow run)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-backport PR that should be backported to another branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants