fix(oci): retry transient token requests - #281
Open
abhinavgautam01 wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves OCI/Docker registry authentication robustness by adding retry logic around bearer-token acquisition, aiming to mitigate transient network/DNS failures and certain retryable HTTP responses, with accompanying regression tests.
Changes:
- Add bounded exponential backoff retries for token fetch on transient request failures and on
429/5xxresponses. - Refactor token response handling into helpers (
decodeTokenResponse,tokenResponseError) and add retry decision helpers. - Add tests covering temporary DNS failures (retry) and permanent auth failures (no retry).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/httpclient/transport.go | Implements token-request retry loop with backoff, plus helper functions for decoding/errors and retry decisions. |
| internal/httpclient/transport_test.go | Adds regression tests verifying retries on temporary DNS failures and no retries on 401 responses. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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
Fixes #266.
429) and server-error (5xx) token responses.401).Validation
gofmtgo tool golangci-lint run ./...go vet ./...go test -race ./...git diff --check