Skip to content

feat: migrate ORAS CLI from oras-go v2 to v3 #2008

Closed

Description

@TerryHowe

Overview

This issue tracks the full migration of the ORAS CLI from oras.land/oras-go/v2 to github.com/oras-project/oras-go/v3. The migration is broken into three phases:

  1. Mechanical API migration — import path and breaking API renames (PR feat: migrate from oras-go v2 to v3 #2002)
  2. Deprecation cleanup — remove duplicated internal code now first-class in v3
  3. New feature adoption — unlock user-facing capabilities provided by v3

Motivation

oras-go v3 introduces a new module path, several breaking API renames, and new packages that provide capabilities the ORAS CLI currently either lacks entirely or implements through duplicated custom code. The primary user-facing motivation is support for the standard containers configuration file stack:

containers/image configuration files supported by oras-go v3

Config File Location Benefit to ORAS users
containers-auth.json ~/.config/containers/auth.json Podman/Buildah/Skopeo credentials are read automatically alongside Docker config.json — no --registry-config flag needed
containers-registries.conf /etc/containers/registries.conf Registry mirrors, blocked registries, and location remapping are applied automatically on every pull — critical for air-gapped and enterprise deployments
containers-certs.d /etc/containers/certs.d/<host>/ Per-registry CA certificates and client TLS certs are loaded without --ca-file flags

Beyond the config-file ecosystem, full v3 adoption also:

  • Fixes a process-safety bug in the ORAS_CACHE path (oci.New() is not safe for concurrent process writes)
  • Removes ~300 lines of duplicated internal code (internal/cache/, internal/trace/transport.go)
  • Adds structured error messages for oras cp that distinguish source from destination failures

Phases & Timeline

Phase 1 — Mechanical API Migration (PR #2002)

Status: ready for review — phases 2–4 remain open after it merges

Replace all oras.land/oras-go/v2 imports with github.com/oras-project/oras-go/v3 and update all breaking call sites.

Change Status
Import path oras.land/oras-go/v2 → github.com/oras-project/oras-go/v3 ✅ Done
auth.Credential{} → credentials.Credential{} ✅ Done
auth.EmptyCredential → credentials.EmptyCredential ✅ Done
client.Credential = → client.CredentialFunc = ✅ Done
credentials.Credential(store) → remote.NewCredentialFunc(store) ✅ Done
credentials.Login/Logout → remote.Login/Logout ✅ Done
repo.Client/PlainHTTP/HandleWarning → repo.Registry.* ✅ Done
repo.Reference.Repository → repo.RepositoryName ✅ Done
ref.Reference (field) → ref.GetReference() (method) ✅ Done
SetReferrersCapability() — void, no longer returns error ✅ Done

Phase 2 — Deprecation Cleanup (follow-on PRs)

Remove internal code that is now first-class in oras-go v3.

# Task Files Net LOC Notes
2.1 oci.New() → oci.NewStorage() in cache option/cache.go −2 Fixes concurrent-write safety bug for shared ORAS_CACHE
2.2 Delete internal/cache/; use oras-go/content/cache internal/cache/, option/cache.go −100 Library now ships CacheReadOnlyTarget with correct oci.NewStorage() backing
2.3 Replace custom handleWarning() with remote.NewWarningLogger() option/remote.go −25 Requires slog→logrus bridge (~15 lines) since v3 uses *slog.Logger
2.4 Replace internal/trace/transport.go with remote.NewLoggingTransport() via ClientBuilder.Logger internal/trace/, option/remote.go −160 Same header scrubbing + body cap; adds request IDs for concurrent correlation

Phase 3 — New Feature Adoption (follow-on PRs)

3.1 ClientBuilder + properties.Registry in NewRepository()/NewRegistry()

Replace the 40+ line manual assembly of tls.Config → http.Transport → retry.Transport → auth.Client with ClientBuilder, which handles TLS, retry, credentials, user-agent, and debug logging in one place.

3.2 config.LoadConfigs() — Full Ecosystem Config Stack

Use config.LoadConfigs() as the baseline for registry configuration, then override with CLI flags. This is the key change that unlocks the containers config-file ecosystem:

config.LoadConfigs()
  ├── Docker config.json          (credentials)
  ├── containers/auth.json        (Podman/Buildah/Skopeo credentials)
  ├── containers/registries.conf  (mirrors, blocked registries, location rewrites)
  └── containers/certs.d/         (per-registry TLS certificates)

CLI flags continue to take highest priority — no change in behavior for users who specify flags explicitly.

Capabilities unlocked at zero additional CLI surface:

  • Podman users: podman login-saved credentials work automatically
  • Enterprise/air-gapped: registries.conf mirrors tried on every pull, no config needed
  • Operators: per-registry CA certs from certs.d load without --ca-file

Future flags (separate PRs):

  • --registries-config — override path to registries.conf
  • --policy-file — override path to policy.json

3.3 oras.CopyError Structured Error Handling

Wrap oras.Copy() failures with *oras.CopyError to produce actionable messages distinguishing source from destination failures in oras cp, oras push, oras pull, and oras attach.


Phase 4 — Future Work (separate design required)

Capability oras-go Package Notes
Policy enforcement (--policy-file) registry/remote/policy Requires UX design for insecureAcceptAnything / reject / signedBy rules
OpenPGP signature verification registry/remote/signature Depends on registries.d config and lookaside store support
objects package for push/pack objects Higher-level alternative to PackManifest; consider for oras push simplification
properties.NewReferenceList for multi-tag references registry/remote/properties Convenience for oras tag with comma-separated tags

Implementation Order

# Task Unblocked By
1 PR #2002 — mechanical API migration —
2 oci.New() → oci.NewStorage() PR #2002
3 Delete internal/cache/ step 2
4 slog→logrus bridge (internal/logutil/) PR #2002
5 remote.NewWarningLogger() step 4
6 ClientBuilder in NewRepository()/NewRegistry() steps 4, 5
7 config.LoadConfigs() full config stack step 6
8 remote.NewLoggingTransport() via builder.Logger step 6
9 oras.CopyError structured errors PR #2002

References

Activity

  1. github-actions commented on May 18, 2026

    @github-actions

    This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

  2. added
    stale
    on May 18, 2026
  3. added and removed
    stale
    on May 23, 2026
  4. added this to the v1.4.0 milestone on May 23, 2026
  5. TerryHowe commented on Nov 4, 2026

    @TerryHowe
    MemberAuthor

    Closing this — the migration landed and the remainder is now tracked as discrete issues.

    What shipped

    #2002 merged on 2026-11-02. The tree is fully on github.com/oras-project/oras-go/v3 v3.0.0 with zero oras-go/v2 imports remaining. Beyond the mechanical phase 1, several later phases went in with it:

    Phase Item State
    1 Mechanical API migration ✅ #2002
    3.2 config.LoadConfigs() — full containers config stack ✅ containers_config.go, behind ORAS_EXPERIMENTAL_CONTAINERS_CONFIG
    3.3 oras.CopyError structured errors ✅ option/binary_target.go, internal/errors/errors.go
    4 policy.json + signedBy verification ✅ containersPolicyEvaluator(), ahead of the schedule above

    So containers-auth.json, containers-registries.conf and containers-certs.d are all wired up, which was the headline motivation for this issue.

    What remains

    Phase 2 in full, plus the unfinished part of 3.1:

    All five are in the future milestone, to be picked up after v1.4.0 ships. #2314 gates #2315 and #2316, since both need the slog bridge.

    Two corrections to the plan as written above

    2.4 cannot be done as described. v3's LoggingTransport scrubs a hardcoded header list, while trace.NewTransport takes the user's --header names. Swapping as-is would print custom auth headers in cleartext under --debug, and CI would not catch it. #2315 is blocked on an oras-go change to make the scrub list configurable.

    3.1 will not deliver the predicted LOC reduction. ClientBuilder has no hook for the origin-scoped stripping of client certificates and --header values on cross-origin redirects (registryCredentialTransport), which is the bulk of authClientWithProperties. #2316 covers the design decision that needs making first.

    Unrelated but worth noting

    The credential-resolution regression caught in review on #2002 was missed by CI because e2e only exercises localhost registries. That gap is still open and would be worth closing before the #2316 refactor touches this code.

    Also: #2118 (Custom CA store) may be satisfied by the merged certs.d support, but only behind ORAS_EXPERIMENTAL_CONTAINERS_CONFIG — worth confirming before closing it, since #2002's Closes #2118 was flagged in review as premature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions