Paginate Docker tag listing and classify registry error responses#15650
Closed
robaiken wants to merge 1 commit into
Closed
Paginate Docker tag listing and classify registry error responses#15650robaiken wants to merge 1 commit into
robaiken wants to merge 1 commit into
Conversation
Images with very large tag counts (e.g. hexpm/elixir has ~1M tags) make registries such as Docker Hub time out (HTTP 504) when Dependabot requests the full, unpaginated tags/list, which surfaced as an unknown_error. - Fall back to a paginated tags/list request (?n=100) when the registry can't return the full list at once, following the registry's pagination links to collect the remaining tags. The common case still makes a single unpaginated request. - Classify the gem's RegistryHTTPException (5xx, including 504) as a PrivateSourceBadResponse instead of unknown_error. - Classify RegistryAuthorizationException (HTTP 403) as a PrivateSourceAuthenticationFailure alongside the existing 401 handling, at every registry-touching rescue site. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9d5f2c82-4124-4996-99cd-e6fd2e11874d
Contributor
There was a problem hiding this comment.
Pull request overview
Adds resilient Docker registry tag retrieval and clearer registry error classification.
Changes:
- Falls back to paginated tag retrieval after registry HTTP failures.
- Classifies 403 and persistent registry failures appropriately.
- Adds regression coverage for fallback and error handling.
Show a summary per file
| File | Description |
|---|---|
docker/lib/dependabot/docker/update_checker.rb |
Implements pagination fallback and registry exception handling. |
docker/spec/dependabot/docker/update_checker_spec.rb |
Tests 403, successful 504 fallback, and persistent 504 behavior. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Medium
Contributor
Author
|
Superseded by #15651, which opens the same change from a branch on dependabot/dependabot-core rather than a fork. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Docker/
docker_composeupdate jobs fail withunknown_errorfor images whose registry can't return the full tag list in one response. The clearest case is images with very large tag counts — e.g.hexpm/elixirhas ~993k tags, so Docker Hub'sGET /v2/hexpm/elixir/tags/list(requested unpaginated) times out with an HTTP 504 after 30s on every run.Root cause:
Dependabot::Docker::UpdateChecker#tags_from_registryrequests the tag list without a page size, and thedocker_registry2gem wraps the resulting 504 inDockerRegistry2::RegistryHTTPException, which wasn't rescued — so it surfaced asunknown_error. Separately, a 403 raisesRegistryAuthorizationException(sibling of the already-handledRegistryAuthenticationException), which was also unclassified.Changes
tags_from_registrynow makes a single unpaginated request for the common case, and falls back to a paginated request (?n=100) when the registry can't return the full list at once, following the registry's pagination links. This keeps the efficient single call for normal images while avoiding the 504 for large ones.RegistryHTTPException(incl. 504) now raisesPrivateSourceBadResponseinstead ofunknown_error.RegistryAuthorizationExceptionnow raisesPrivateSourceAuthenticationFailurealongside the existing 401 handling, at every registry-touching rescue site.This also fixes the
docker_composeecosystem, which reusesDependabot::Docker::UpdateChecker.Tests
?n=100request is made).PrivateSourceBadResponse.PrivateSourceAuthenticationFailure.Full docker suite: 573 examples, 0 failures; RuboCop clean; Sorbet
No errors!.Note
Pagination resolves the general class of failure. For pathological tag counts like
hexpm/elixir(~1M tags), paginating at 100/page is many round-trips; a follow-up could cap the number of pages/tags fetched, but that's out of scope here.