fix: Remove work-arounds once oras-go creates patch release#32200
Open
arnavnagzirkar wants to merge 1 commit into
Open
fix: Remove work-arounds once oras-go creates patch release#32200arnavnagzirkar wants to merge 1 commit into
arnavnagzirkar wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
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/v2fromv2.6.0tov2.6.1. - Change
Client.Loginto store credentials underServerAddressFromRegistry(host)without additional hostname normalization. - Update
registry_test.goexpected 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 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 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) |
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]>
3c1a827 to
dbf2488
Compare
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. |
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
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) fixedServerAddressFromRegistryto 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.provis 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: Upgradedoras.land/oras-go/v2fromv2.6.0tov2.6.1.go.sum: Updated checksums viago getandgo mod tidy.pkg/registry/client.go-(*Client).Login(): Removed thekey = credentials.ServerAddressFromHostname(key)line that was a workaround for the oras-go v2.6.0ServerAddressFromRegistrybug.pkg/registry/registry_test.go-testPush()andtestPull(): Updated provenance layer digest (b0a02b74...to2ddc271b...), 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
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.