Skip to content

Fix #31386: Remove work-arounds once oras-go creates patch release#32017

Closed
utafrali wants to merge 1 commit intohelm:mainfrom
utafrali:fix/issue-31386-remove-work-arounds-once-oras-go-creates
Closed

Fix #31386: Remove work-arounds once oras-go creates patch release#32017
utafrali wants to merge 1 commit intohelm:mainfrom
utafrali:fix/issue-31386-remove-work-arounds-once-oras-go-creates

Conversation

@utafrali
Copy link
Copy Markdown

@utafrali utafrali commented Apr 7, 2026

Fixes #31386

Copilot AI review requested due to automatic review settings April 7, 2026 21:12
@pull-request-size pull-request-size Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 7, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request removes work-arounds that were implemented for bugs in the oras-go library (version 2.6.0). After updating to a patched version of oras-go (v2.6.1-0.20251010150221-ba36eb50d8f7), these work-arounds are no longer necessary and are being cleaned up to simplify the codebase.

Changes:

  • Simplifies HTTP transport cloning logic by directly using http.DefaultTransport.(*http.Transport).Clone() instead of defensive type assertion checks
  • Removes the ForceAttemptOAuth2 manipulation and retry logic from the Login function, which was a work-around for OAuth2 handling issues in oras-go
  • Removes test functions that specifically verified the work-around behavior (TestLogin_ResetsForceAttemptOAuth2_OnSuccess and TestLogin_ResetsForceAttemptOAuth2_OnFailure)
  • Cleans up unused imports from client_test.go that were only needed by the removed test functions
  • Updates oras-go dependency from v2.6.0 to v2.6.1-0.20251010150221-ba36eb50d8f7

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/registry/transport.go Simplifies transport cloning logic by removing defensive type checks
pkg/registry/client.go Removes ForceAttemptOAuth2 workaround and retry logic from Login function
pkg/registry/client_test.go Removes workaround-specific tests and cleans up unused imports
go.mod Updates oras-go to patched version
go.sum Updates oras-go checksums

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/registry/client.go
c.authorizer.ForceAttemptOAuth2 = true
reg.Client = c.authorizer

ctx := context.Background()
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of error recovery retry logic in the Login function (line 259) simplifies the code significantly, relying on the assumption that the underlying oras-go library bug has been fixed. While this is the intended purpose of the PR, consider adding a comment explaining why the retry logic with ForceAttemptOAuth2 is no longer necessary for maintainability. This helps future developers understand that this wasn't just a cleanup but a fix for a dependency issue.

Suggested change
ctx := context.Background()
ctx := context.Background()
// A previous implementation retried authentication with ForceAttemptOAuth2
// to work around an oras-go login bug. That workaround is intentionally no
// longer needed now that the upstream issue has been fixed, so a single Ping
// is sufficient here.

Copilot uses AI. Check for mistakes.
@TerryHowe TerryHowe added keep open Has One Approval This PR has one approval. It still needs a second approval to be merged. and removed Has One Approval This PR has one approval. It still needs a second approval to be merged. labels Apr 8, 2026
@TerryHowe
Copy link
Copy Markdown
Contributor

It is going to be a while before oras-go is ready.

@utafrali
Copy link
Copy Markdown
Author

utafrali commented Apr 8, 2026

Got it - should I close this then and wait for oras-go to be ready?

@TerryHowe
Copy link
Copy Markdown
Contributor

Yeh, that would probably be best

@TerryHowe TerryHowe closed this Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

keep open size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove work-arounds once oras-go creates patch release

3 participants