Repository navigation
fix(docker): keep the registry host in image row names - #617
17302513901yh-lang wants to merge 1 commit into
Conversation
|
Thanks so much for this, @17302513901yh-lang — the write-up and tests are really clear, especially covering two registries that share a path and a registry with a port. An equivalent fix is already in review in #599. It keeps the registry host on non-Docker-Hub names (including We'll leave this PR open so you can follow along. If you'd like to pick up something else, issues labelled |
|
Quick update, @17302513901yh-lang: #599 has now merged, so registry hosts stay on non-Docker-Hub image names on As mentioned, we kept this open so you could follow along, so I'll close it now that the equivalent change has landed. Your Swift fix in #598 is in today's release too. Thanks for both! |
Fixes #578.
What changed
parseDockerfileandparseDockerComposedroppedparsed.registrywhen they built the row name, so every image was recorded aslibrary/<image>or<namespace>/<image>. Non-Docker-Hub images were then looked up on Docker Hub under a path that belongs to a different image, and two registries with the same path collapsed into one row.dockerRowName()indocker-cache.ts, used by both parsers, by the cache/manifest key infetchDockerLatestVersion, and by its "only Docker Hub" guard. A registry is kept unless it is a Docker Hub alias (docker.io,index.docker.io,registry-1.docker.io), so Docker Hub names stay exactly as documented.docker-scanner.tsuses it in both parsers.Root cause worth noting:
fetchDockerLatestVersionalready hadif (parsed.registry && parsed.registry !== 'docker.io') return null, but it receives the row name, which no longer contained the registry, so the guard never fired. Keeping the registry in the name is what makes it work, so no extra filtering layer is needed.Tests
test/docker-registry-host.test.ts, 6 cases:ghcr.io/acme/api,mcr.microsoft.com/dotnet/sdk,quay.io/prometheus/node-exporterkeep the registry, staydrift: unknown, and none of them reaches the Docker Hub lookup.docker-compose.yml.nginx:1.27.0andbitnami/redis:7.4.1behave exactly as before (library/nginx,bitnami/redis, driftcurrent).docker.io/library/nginxandindex.docker.io/bitnami/redishave the alias stripped.ghcr.io/acme/apiandquay.io/acme/apistay two rows.localhost:5000/team/appkeeps its port.Note: the
node_modulesin this checkout was incomplete and the package manager install is blocked here, so CI is the first full run of the suite.