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

Aberta Para iniciantes
#11 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
90/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
docker, go
Domínio
devops

Direção de pesquisa

Comece com do() em internal/source/registry.go e examine a construção das URLs e o tratamento existente da próxima página. Atualize o fake registry e as assertions em internal/source/source_test.go para exigir caminhos /v2/, incluindo requisições HEAD de manifestos, e verifique o comportamento do cache em internal/source/resolve.go. Execute os testes Go relevantes; um contêiner uptime-kuma:2 sem tag deve ser resolvido para uma versão real, e tags ausentes não devem ser mantidas em cache permanentemente.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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).

Linguagem predominante
Go
Estrelas
3
Forks
1
Merge médio
1h 11min
PRs com merge (30d)
10

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de NotAFlightRisk/patchcall

Todas as issues de NotAFlightRisk/patchcall

Issues semelhantes

Mais issues de Go

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.