[Bug]: Registry lookup always fails, so untagged images stay unknown

Abierto Apto para principiantes
#11 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
90/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
docker, go
Área
devops

Línea de trabajo

Comienza con do() en internal/source/registry.go y examina la construcción de las URL y el tratamiento existente de la página siguiente. Actualiza el registro falso y las aserciones de internal/source/source_test.go para exigir rutas /v2/, incluidas las solicitudes HEAD de manifiestos, y comprueba el comportamiento del almacenamiento en caché en internal/source/resolve.go. Ejecuta las pruebas de Go relevantes; un contenedor uptime-kuma:2 sin etiqueta debe resolverse a una versión real, y las etiquetas inexistentes no deben almacenarse en caché de forma permanente.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug good first issue
What happened?

The registry lookup never works, so any image on :latest, :2, :main or similar without a version label comes out as "Version unknown: registry lookup failed ... 404". The registry URLs are missing /v2/, so Docker Hub answers 404 and GHCR answers 303. With /v2/ added by hand, the same lookup for louislam/uptime-kuma:2 finds 2.5.12.

That lookup is what the README says makes :latest work, so it's a bit of a big one, but the fix is tiny.

Steps to reproduce
  1. Run the compose stack from the README
  2. Run louislam/uptime-kuma:2 next to it (it has no version label)
  3. Patchcall lists it as "Version unknown: registry lookup failed ... 404"
Version

1.0.0, and still there on main at 31c39ef

How are you running it?

Docker, with the README's compose file

Environment

Linux, Docker Engine

Relevant log output
Version unknown: registry lookup failed ... 404
Before submitting
  • I have searched existing issues for duplicates
  • I am running the latest version
  • I agree to follow this project's Code of Conduct
Fix

do() in internal/source/registry.go:104-108 builds https://<registry>/<path><suffix>. Make it https://<api>/v2/<path><suffix>. The next-page handling at registry.go:98 already strips /v2/<path>, so that bit stays as it is.

The test in internal/source/source_test.go:95 only checks the path ends in /tags/list, which is how this got past it. Make the fake registry refuse anything that isn't under /v2/, for the manifest HEADs too.

While you're in there: an empty result gets cached for good (internal/source/resolve.go:122), so a :latest pulled before its version tag lands stays unknown until the next pull. Only cache a tag it actually found.

To check it, an uptime-kuma:2 container with no version label should show its real version (2.5.12 at the time of writing).

Lenguaje dominante
Go
Estrellas
3
Forks
1
Merge medio
1 h 11 min
PR fusionados (30 d)
10

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de NotAFlightRisk/patchcall

Todos los issues de NotAFlightRisk/patchcall

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.