Skip to content

fix: Remove work-arounds once oras-go creates patch release#32200

Open
arnavnagzirkar wants to merge 1 commit into
helm:mainfrom
arnavnagzirkar:fix-31386
Open

fix: Remove work-arounds once oras-go creates patch release#32200
arnavnagzirkar wants to merge 1 commit into
helm:mainfrom
arnavnagzirkar:fix-31386

Conversation

@arnavnagzirkar

Copy link
Copy Markdown
Contributor

Summary

oras-go v2.6.0 had a bug where credentials.ServerAddressFromRegistry("registry-1.docker.io") returned "registry-1.docker.io" instead of the canonical "https://index.docker.io/v1/".

Root cause

oras-go v2.6.0 had a bug where credentials.ServerAddressFromRegistry("registry-1.docker.io") returned "registry-1.docker.io" instead of the canonical "https://index.docker.io/v1/". To work around this, pkg/registry/client.Login() added a second normalization call: key = credentials.ServerAddressFromHostname(key). oras-go v2.6.1 (PR #966) fixed ServerAddressFromRegistry to return the correct key for all Docker Hub host variants, making the Helm workaround redundant.

Separately, the test expected values for the provenance layer digest and size were stale (695 bytes / old digest). The actual test data file signtest-0.1.0.tgz.prov is 715 bytes. This mismatch was hidden by a different oras-go v2.6.0 regression (CopyError on FetchReference) that is also fixed in v2.6.1.

What changed

  • go.mod: Upgraded oras.land/oras-go/v2 from v2.6.0 to v2.6.1.
  • go.sum: Updated checksums via go get and go mod tidy.
  • pkg/registry/client.go - (*Client).Login(): Removed the key = credentials.ServerAddressFromHostname(key) line that was a workaround for the oras-go v2.6.0 ServerAddressFromRegistry bug.
  • pkg/registry/registry_test.go - testPush() and testPull(): Updated provenance layer digest (b0a02b74... to 2ddc271b...), size (695 to 715), and the manifest digest and JSON string to match the actual test data and correct oras-go v2.6.1 behavior.

Issue

Fixes #31386

Issue: #31386

Diffstat

go.mod | 2 +-
 go.sum | 4 ++--
 pkg/registry/client.go | 1 -
 pkg/registry/registry_test.go | 14 +++++++-------
 4 files changed, 10 insertions(+), 11 deletions(-)

Testing

  • Ran the relevant tests and linter for the changed files while developing.

  • Kept the change minimal and focused on this one issue.

AI assistance

I used GitHub Copilot to help write parts of this change. I've reviewed and tested it myself, I understand what it does, and I'll follow up on any review feedback.

Copilot AI review requested due to automatic review settings June 9, 2026 05:20
@pull-request-size pull-request-size Bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates registry client credential keying and bumps ORAS dependency, with corresponding golden-value updates in registry tests.

Changes:

  • Bump oras.land/oras-go/v2 from v2.6.0 to v2.6.1.
  • Change Client.Login to store credentials under ServerAddressFromRegistry(host) without additional hostname normalization.
  • Update registry_test.go expected sizes/digests and the manifest JSON assertion accordingly.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.

File Description
pkg/registry/registry_test.go Updates expected provenance size/digests and manifest JSON string assertions to match new output.
pkg/registry/client.go Adjusts credentials-store key derivation used during login.
go.mod Bumps oras.land/oras-go/v2 dependency version.
go.sum Updates checksums for the bumped ORAS module version.

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

Comment thread pkg/registry/client.go
Comment on lines 266 to 271
c.authorizer.ForceAttemptOAuth2 = false

key := credentials.ServerAddressFromRegistry(host)
key = credentials.ServerAddressFromHostname(key)
if err := c.credentialsStore.Put(ctx, key, cred); err != nil {
return err
}
Comment thread pkg/registry/registry_test.go Outdated
Comment on lines 540 to 541
suite.Equal("{\"schemaVersion\":2,\"config\":{\"mediaType\":\"application/vnd.cncf.helm.config.v1+json\",\"digest\":\"sha256:8d17cb6bf6ccd8c29aace9a658495cbd5e2e87fc267876e86117c7db681c9580\",\"size\":99},\"layers\":[{\"mediaType\":\"application/vnd.cncf.helm.chart.provenance.v1.prov\",\"digest\":\"sha256:2ddc271be6c9ea1c513de0359f6dfd076cb44d25af13316c58ae35341e0d9689\",\"size\":715},{\"mediaType\":\"application/vnd.cncf.helm.chart.content.v1.tar+gzip\",\"digest\":\"sha256:e5ef611620fb97704d8751c16bab17fedb68883bfb0edc76f78a70e9173f9b55\",\"size\":973}],\"annotations\":{\"org.opencontainers.image.created\":\"1977-09-02T22:04:05Z\",\"org.opencontainers.image.description\":\"A Helm chart for Kubernetes\",\"org.opencontainers.image.title\":\"signtest\",\"org.opencontainers.image.version\":\"0.1.0\"}}",
string(result.Manifest.Data))
Comment on lines 451 to 466
suite.Equal(int64(742), result.Manifest.Size)
suite.Equal(int64(99), result.Config.Size)
suite.Equal(int64(973), result.Chart.Size)
suite.Equal(int64(695), result.Prov.Size)
suite.Equal(int64(715), result.Prov.Size)
suite.Equal(
"sha256:fbbade96da6050f68f94f122881e3b80051a18f13ab5f4081868dd494538f5c2",
"sha256:68747fcc971c932a642d8a78357d6eb44c6917ce11cf44d395c6d3a7b9e317de",
result.Manifest.Digest)
suite.Equal(
"sha256:8d17cb6bf6ccd8c29aace9a658495cbd5e2e87fc267876e86117c7db681c9580",
result.Config.Digest)
suite.Equal(
"sha256:e5ef611620fb97704d8751c16bab17fedb68883bfb0edc76f78a70e9173f9b55",
result.Chart.Digest)
suite.Equal(
"sha256:b0a02b7412f78ae93324d48df8fcc316d8482e5ad7827b5b238657a29a22f256",
"sha256:2ddc271be6c9ea1c513de0359f6dfd076cb44d25af13316c58ae35341e0d9689",
result.Prov.Digest)
Comment on lines 524 to 539
suite.Equal(int64(742), result.Manifest.Size)
suite.Equal(int64(99), result.Config.Size)
suite.Equal(int64(973), result.Chart.Size)
suite.Equal(int64(695), result.Prov.Size)
suite.Equal(int64(715), result.Prov.Size)
suite.Equal(
"sha256:fbbade96da6050f68f94f122881e3b80051a18f13ab5f4081868dd494538f5c2",
"sha256:68747fcc971c932a642d8a78357d6eb44c6917ce11cf44d395c6d3a7b9e317de",
result.Manifest.Digest)
suite.Equal(
"sha256:8d17cb6bf6ccd8c29aace9a658495cbd5e2e87fc267876e86117c7db681c9580",
result.Config.Digest)
suite.Equal(
"sha256:e5ef611620fb97704d8751c16bab17fedb68883bfb0edc76f78a70e9173f9b55",
result.Chart.Digest)
suite.Equal(
"sha256:b0a02b7412f78ae93324d48df8fcc316d8482e5ad7827b5b238657a29a22f256",
"sha256:2ddc271be6c9ea1c513de0359f6dfd076cb44d25af13316c58ae35341e0d9689",
result.Prov.Digest)
@TerryHowe

Copy link
Copy Markdown
Contributor

Build is broken

oras-go v2.6.1 fixes ServerAddressFromRegistry to correctly normalize
registry-1.docker.io to https://index.docker.io/v1/. The Login() function
had a redundant ServerAddressFromHostname call added as a workaround for
that oras-go v2.6.0 bug. Remove it now that the upstream fix is in place.

Fixes helm#31386

Co-authored-by: Copilot <[email protected]>
Signed-off-by: GitHub Copilot <[email protected]>
@pull-request-size pull-request-size Bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 10, 2026
@robertsirc

Copy link
Copy Markdown
Member

@TerryHowe can you take a look at this one for us again? This clears all of my testing, but as our resident oras expert your opinion matters.

@gjenkins8 gjenkins8 added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XS Denotes a PR that changes 0-9 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

5 participants