Skip to content

Hide infrastructure images by repository, not exact reference - #2092

Open
devops-thiago wants to merge 1 commit into
apple:mainfrom
devops-thiago:infra-images-by-repository
Open

devops-thiago wants to merge 1 commit into
apple:mainfrom
devops-thiago:infra-images-by-repository

Conversation

@devops-thiago

@devops-thiago devops-thiago commented Aug 7, 2026 •

Copy link
Copy Markdown

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

Fixes #2088.

Utility.isInfraImage compares full references, so it only recognizes the vminit and builder images at the exact version the running build would pull. After an upgrade that bumps the containerization dependency, the previous version's vminit, with the same repository and an older tag, shows up in container image ls as if the user had pulled it.

Nobody pulls an init or builder image on purpose, so any tag of a configured infrastructure repository is infrastructure. The filter keeps the exact-reference match and also compares the reference with its tag or digest removed. The tag colon is found after the last path separator, so a registry with a port (registry.local:5000/repo) is not cut at the port, and @digest suffixes are stripped first.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

UtilityTests has new cases for another tag of the same repository, a digest reference, the registry-port case and user images that only share a name suffix. On the current code the other-tag, digest and registry-port cases fail, for example isInfraImage(name: "ghcr.io/apple/containerization/vminit:0.9.0", ...) returns false. With this change they pass, and the full suite passes.

I also ran a debug build of this branch against a 1.5.0 daemon after pulling ghcr.io/apple/containerization/vminit:0.45.0. container image list on the 1.5.0 release and on main shows that image next to alpine. With this branch only alpine is listed.

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Code Coverage

Tier Line Coverage
Unit 22.22%
Integration 69.44%
Combined 77.51%

@devops-thiago

Copy link
Copy Markdown
Author

@dkovba thank you for approving the workflows. CI passes on this PR and it still merges cleanly into main. Is it good to merge as it is, or is there anything else you need from me?

The infra filter compared full references, so it only recognized the vminit and
builder images at the version this build would pull. The vminit left behind by
the previous engine version — same repository, older tag — surfaced in every
image list after an upgrade, looking like something the user pulled and forgot.

Nobody pulls an init or builder image on purpose. Any tag of a configured
infrastructure repository is infrastructure, so the filter now also matches on
the reference with its tag or digest removed. The tag colon is found after the
last path separator rather than the first colon, because a registry with a port
(registry.local:5000/repo) would otherwise be truncated at the port.

Found by an integration test asserting vminit is never visible, against a store
that still held vminit:0.35.0 beside a 0.40.1 engine — which is exactly the
state every user's store will be in after their first app update.
@devops-thiago
devops-thiago force-pushed the infra-images-by-repository branch from d396219 to ca58988 Compare October 14, 2026 21:01
@devops-thiago

Copy link
Copy Markdown
Author

@dkovba I rebased this onto main: the new tests in UtilityTests.swift conflicted with the ones added by #2390, and I kept both. The code is unchanged. The runs need approval again, thank you.

This branch has not been deployed

No deployments
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.

[Bug]: Stale infrastructure images appear in container image ls after a CLI upgrade

1 participant