feat: migrate from oras-go v2 to v3#2002
feat: migrate from oras-go v2 to v3#2002TerryHowe wants to merge 8 commits intooras-project:mainfrom
Conversation
Migrate all imports from oras.land/oras-go/v2 to github.com/oras-project/oras-go/v3 and update API usage: - Replace module path in go.mod with local replace directive - auth.Credential → credentials.Credential (moved package) - auth.EmptyCredential → credentials.EmptyCredential - client.Credential → client.CredentialFunc - credentials.Credential(store) → store.Get - credentials.Login/Logout → remote.Login/Logout - repo.Client/PlainHTTP/HandleWarning → repo.Registry.* - repo.Reference.Registry → repo.Registry.Reference.Registry - repo.Reference.Repository → repo.RepositoryName - repo.Reference (method) → repo.Reference().GetReference() - ref.Reference (field) → ref.GetReference() - SetReferrersCapability no longer returns error - Import config package to register config loader Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Terry Howe <terrylhowe@gmail.com>
These files are not part of the oras-go v3 migration. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Terry Howe <terrylhowe@gmail.com>
Replace local replace directive with the published tag. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Terry Howe <terrylhowe@gmail.com>
In v3, Repository.Registry must not be nil. Using NewRepository()
instead of &remote.Repository{} to avoid nil pointer dereference
when Reference() is called during Mount.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Terry Howe <terrylhowe@gmail.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2002 +/- ##
==========================================
+ Coverage 87.18% 87.22% +0.04%
==========================================
Files 143 143
Lines 5539 5541 +2
==========================================
+ Hits 4829 4833 +4
+ Misses 423 422 -1
+ Partials 287 286 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- gofmt: reformat errors.go, errors_test.go, binary_target.go - replace deprecated registry.ParseReference/registry.Reference with properties.NewReference/properties.Reference - replace deprecated ref.Reference field with ref.Tag/GetReference() - replace deprecated ValidateReferenceAsTag() with ValidateTag() - replace deprecated auth.AppendRepositoryScope with auth.ScopeRepository + auth.AppendScopesForHost Signed-off-by: Terry Howe <terrylhowe@gmail.com> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Terry Howe <terrylhowe@gmail.com>
- gofmt: reformat packer.go, tags.go, graph.go - replace deprecated registry.ParseReference with properties.NewReference in repo/tags.go Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Terry Howe <terrylhowe@gmail.com>
Run gofmt across the full tree to fix all formatting issues. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Terry Howe <terrylhowe@gmail.com>
Documents remaining deprecation fixes and new v3 features to implement beyond the basic API rename migration in the initial PR. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Terry Howe <terrylhowe@gmail.com>
|
A migration plan document has been added at SummaryRemaining deprecation fixes (bugs / code duplication):
New v3 features to implement:
Steps 3 and 4 require a small slog→logrus bridge ( Steps 5+6 are the most impactful: adopting Full implementation order and code sketches are in the proposal doc. |
Summary
oras.land/oras-go/v2imports withgithub.com/oras-project/oras-go/v3registry/remote/configpackage to register the config loader required by v3Key API Changes
auth.Credential{}credentials.Credential{}auth.EmptyCredentialcredentials.EmptyCredentialclient.Credential =client.CredentialFunc =credentials.Credential(store)store.Getcredentials.Login/Logoutremote.Login/Logoutrepo.Client/PlainHTTP/HandleWarningrepo.Registry.Client/PlainHTTP/HandleWarningrepo.Reference.Registryrepo.Registry.Reference.Registryrepo.Reference.Repositoryrepo.RepositoryNamerepo.Reference(field)repo.Reference()(method)ref.Reference(field)ref.GetReference()SetReferrersCapability()returns errorTest plan
go build ./...succeedsgo test ./...all passgo vet ./...clean🤖 Generated with Claude Code