In version v2, ORAS Go library has been completely refreshed with:
- More unified interfaces
- Notably fewer dependencies
- Higher test coverage
- Better documentation
Additionally, ORAS Go v2 is now a registry client.
- Content store
content.Fileis nowfile.Storecontent.OCIis nowoci.Storecontent.Memoryis nowmemory.Store
- Registry interaction
- Introduces an SDK to interact with OCI-compliant and Docker-compliant registries
- Authentication
- Implements authentication through
auth.Clientand supports credential management viacredentials
- Implements authentication through
- Copy operations
- Enhances artifact copying capabilities between various
Targetwith flexible options - Enables extended-copying of artifacts along with their predecessors (e.g., referrers)
- Enhances artifact copying capabilities between various
-
Get the
v2packagego get oras.land/oras-go/v2
-
Import and use the
v2packageimport "oras.land/oras-go/v2"
-
Run
go mod tidy
Since breaking changes are introduced in v2, code refactoring is required for migrating from v1 to v2.
The migration can be done in an iterative fashion, as v1 and v2 can be imported and used at the same time.
For comprehensive documentation and examples, please refer to pkg.go.dev.
No, v2 does not have a direct 1:1 mapping of APIs with v1, as the structure of the APIs has been significantly redesigned. Instead of looking for a direct replacement, see this as a chance to upgrade your application with v2's new features.
You can explore the end-to-end examples that demonstrate the usage of v2 in practical scenarios.
If you encounter challenges during migration, seek assistance from the community by submitting GitHub issues or asking in the #oras Slack channel.