Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/oras/internal/display/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"os"

ocispec "github.com/opencontainers/image-spec/specs-go/v1"
fetcher "oras.land/oras-go/v2/content"
fetcher "github.com/oras-project/oras-go/v3/content"

"oras.land/oras/cmd/oras/internal/display/content"
"oras.land/oras/cmd/oras/internal/display/metadata"
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/internal/display/metadata/model/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"sync"

ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"oras.land/oras-go/v2/content/file"
"github.com/oras-project/oras-go/v3/content/file"
)

// File records metadata of a pulled file.
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/internal/display/metadata/table/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"strings"

ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"oras.land/oras-go/v2/content"
"github.com/oras-project/oras-go/v3/content"
"oras.land/oras/cmd/oras/internal/display/metadata"
"oras.land/oras/cmd/oras/internal/output"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/internal/display/status/discard.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"oras.land/oras-go/v2"
"github.com/oras-project/oras-go/v3"
)

func discardStopTrack() error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/internal/display/status/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"oras.land/oras-go/v2"
"github.com/oras-project/oras-go/v3"
)

// StopTrackTargetFunc is the function type to stop tracking a target.
Expand Down
4 changes: 2 additions & 2 deletions cmd/oras/internal/display/status/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (

"github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"oras.land/oras-go/v2"
"oras.land/oras-go/v2/content"
"github.com/oras-project/oras-go/v3"
"github.com/oras-project/oras-go/v3/content"
"oras.land/oras/cmd/oras/internal/output"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/internal/display/status/text_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"testing"

ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"oras.land/oras-go/v2/content/memory"
"github.com/oras-project/oras-go/v3/content/memory"
"oras.land/oras/cmd/oras/internal/output"
"oras.land/oras/internal/testutils"
)
Expand Down
6 changes: 3 additions & 3 deletions cmd/oras/internal/display/status/track/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import (
"os"

ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"oras.land/oras-go/v2"
"oras.land/oras-go/v2/errdef"
"oras.land/oras-go/v2/registry"
"github.com/oras-project/oras-go/v3"
"github.com/oras-project/oras-go/v3/errdef"
"github.com/oras-project/oras-go/v3/registry"
sprogress "oras.land/oras/cmd/oras/internal/display/status/progress"
"oras.land/oras/internal/progress"
)
Expand Down
16 changes: 10 additions & 6 deletions cmd/oras/internal/display/status/track/target_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import (

"github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"oras.land/oras-go/v2"
"oras.land/oras-go/v2/content/memory"
"oras.land/oras-go/v2/errdef"
"oras.land/oras-go/v2/registry/remote"
"github.com/oras-project/oras-go/v3"
"github.com/oras-project/oras-go/v3/content/memory"
"github.com/oras-project/oras-go/v3/errdef"
"github.com/oras-project/oras-go/v3/registry/remote"
"oras.land/oras/internal/progress"
"oras.land/oras/internal/testutils"
)
Expand Down Expand Up @@ -87,8 +87,12 @@ func Test_referenceGraphTarget_PushReference(t *testing.T) {
}
}

func Test_referenceGraphTarget_Mount(_ *testing.T) {
target := graphTarget{GraphTarget: &remote.Repository{}}
func Test_referenceGraphTarget_Mount(t *testing.T) {
repo, err := remote.NewRepository("localhost/repo")
if err != nil {
t.Fatal(err)
}
target := graphTarget{GraphTarget: repo}
_ = target.Mount(context.Background(), ocispec.Descriptor{}, "", nil)
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/oras/internal/display/status/tty.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
"oras.land/oras/internal/graph"

ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"oras.land/oras-go/v2"
"oras.land/oras-go/v2/content"
"github.com/oras-project/oras-go/v3"
"github.com/oras-project/oras-go/v3/content"
"oras.land/oras/cmd/oras/internal/display/status/track"
"oras.land/oras/internal/progress"
)
Expand Down
4 changes: 2 additions & 2 deletions cmd/oras/internal/display/status/tty_console_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"strconv"
"testing"

"oras.land/oras-go/v2"
"oras.land/oras-go/v2/content/memory"
"github.com/oras-project/oras-go/v3"
"github.com/oras-project/oras-go/v3/content/memory"
"oras.land/oras/internal/testutils"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/internal/display/status/tty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"testing"

ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"oras.land/oras-go/v2/content/memory"
"github.com/oras-project/oras-go/v3/content/memory"
"oras.land/oras/internal/testutils"
)

Expand Down
6 changes: 3 additions & 3 deletions cmd/oras/internal/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import (
"fmt"
"strings"

"github.com/oras-project/oras-go/v3"
"github.com/oras-project/oras-go/v3/registry/remote/auth"
"github.com/oras-project/oras-go/v3/registry/remote/errcode"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"oras.land/oras-go/v2"
"oras.land/oras-go/v2/registry/remote/auth"
"oras.land/oras-go/v2/registry/remote/errcode"
)

// OperationType stands for certain type of operations.
Expand Down
4 changes: 2 additions & 2 deletions cmd/oras/internal/errors/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
"net/url"
"testing"

"github.com/oras-project/oras-go/v3"
"github.com/oras-project/oras-go/v3/registry/remote/errcode"
"github.com/spf13/pflag"
"oras.land/oras-go/v2"
"oras.land/oras-go/v2/registry/remote/errcode"
)

func TestCheckMutuallyExclusiveFlags(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/internal/option/binary_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
"fmt"
"sync"

"github.com/oras-project/oras-go/v3"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"oras.land/oras-go/v2"
oerrors "oras.land/oras/cmd/oras/internal/errors"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/internal/option/binary_target_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"errors"
"testing"

"github.com/oras-project/oras-go/v3"
"github.com/spf13/cobra"
"oras.land/oras-go/v2"
)

func TestBinaryTarget_ModifyError(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions cmd/oras/internal/option/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ package option
import (
"os"

"oras.land/oras-go/v2"
"oras.land/oras-go/v2/content/oci"
"github.com/oras-project/oras-go/v3"
"github.com/oras-project/oras-go/v3/content/oci"
"oras.land/oras/internal/cache"
)

Expand Down
6 changes: 3 additions & 3 deletions cmd/oras/internal/option/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import (
"reflect"
"testing"

"oras.land/oras-go/v2"
"oras.land/oras-go/v2/content/memory"
"oras.land/oras-go/v2/content/oci"
"github.com/oras-project/oras-go/v3"
"github.com/oras-project/oras-go/v3/content/memory"
"github.com/oras-project/oras-go/v3/content/oci"
"oras.land/oras/internal/cache"
)

Expand Down
6 changes: 3 additions & 3 deletions cmd/oras/internal/option/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ limitations under the License.
package option

import (
"oras.land/oras-go/v2"
"oras.land/oras-go/v2/content"
"oras.land/oras-go/v2/registry"
"github.com/oras-project/oras-go/v3"
"github.com/oras-project/oras-go/v3/content"
"github.com/oras-project/oras-go/v3/registry"
)

// ResolvableDeleter a target that resolve and delete
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/internal/option/packer.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import (
"strings"

ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/oras-project/oras-go/v3/content"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"oras.land/oras-go/v2/content"
oerrors "oras.land/oras/cmd/oras/internal/errors"
"oras.land/oras/cmd/oras/internal/fileref"
)
Expand Down
34 changes: 16 additions & 18 deletions cmd/oras/internal/option/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ import (
"strings"
"sync"

"github.com/oras-project/oras-go/v3/errdef"
"github.com/oras-project/oras-go/v3/registry/remote"
"github.com/oras-project/oras-go/v3/registry/remote/auth"
"github.com/oras-project/oras-go/v3/registry/remote/credentials"
"github.com/oras-project/oras-go/v3/registry/remote/errcode"
"github.com/oras-project/oras-go/v3/registry/remote/retry"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"oras.land/oras-go/v2/errdef"
"oras.land/oras-go/v2/registry/remote"
"oras.land/oras-go/v2/registry/remote/auth"
"oras.land/oras-go/v2/registry/remote/credentials"
"oras.land/oras-go/v2/registry/remote/errcode"
"oras.land/oras-go/v2/registry/remote/retry"
oerrors "oras.land/oras/cmd/oras/internal/errors"
"oras.land/oras/internal/credential"
"oras.land/oras/internal/crypto"
Expand Down Expand Up @@ -264,7 +264,7 @@ func (remo *Remote) authClient(_ string, debug bool) (client *auth.Client, err e
client = &auth.Client{
Client: &http.Client{
// http.RoundTripper with a retry using the DefaultPolicy
// see: https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/retry#Policy
// see: https://pkg.go.dev/github.com/oras-project/oras-go/v3/registry/remote/retry#Policy
Transport: retry.NewTransport(baseTransport),
},
Cache: auth.NewCache(),
Expand All @@ -276,8 +276,8 @@ func (remo *Remote) authClient(_ string, debug bool) (client *auth.Client, err e
}

cred := remo.Credential()
if cred != auth.EmptyCredential {
client.Credential = func(_ context.Context, _ string) (auth.Credential, error) {
if !cred.IsEmpty() {
client.CredentialFunc = func(_ context.Context, _ string) (credentials.Credential, error) {
return cred, nil
}
} else {
Expand All @@ -286,7 +286,7 @@ func (remo *Remote) authClient(_ string, debug bool) (client *auth.Client, err e
if err != nil {
return nil, err
}
client.Credential = credentials.Credential(remo.store)
client.CredentialFunc = remo.store.Get
}
return
}
Expand Down Expand Up @@ -320,7 +320,7 @@ func (remo *Remote) parseCustomHeaders() error {
}

// Credential returns a credential based on the remote options.
func (remo *Remote) Credential() auth.Credential {
func (remo *Remote) Credential() credentials.Credential {
return credential.Credential(remo.Username, remo.Secret)
}

Expand Down Expand Up @@ -365,17 +365,15 @@ func (remo *Remote) NewRepository(reference string, common Common, logger logrus
}
return nil, err
}
registry := repo.Reference.Registry
repo.PlainHTTP = remo.isPlainHTTP(registry)
repo.HandleWarning = remo.handleWarning(registry, logger)
if repo.Client, err = remo.authClient(registry, common.Debug); err != nil {
registry := repo.Registry.Reference.Registry
repo.Registry.PlainHTTP = remo.isPlainHTTP(registry)
repo.Registry.HandleWarning = remo.handleWarning(registry, logger)
if repo.Registry.Client, err = remo.authClient(registry, common.Debug); err != nil {
return nil, err
}
repo.SkipReferrersGC = true
if remo.ReferrersAPI != ReferrersStateUnknown {
if err := repo.SetReferrersCapability(remo.ReferrersAPI == ReferrersStateSupported); err != nil {
return nil, err
}
repo.SetReferrersCapability(remo.ReferrersAPI == ReferrersStateSupported)
}
return
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/oras/internal/option/remote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ import (
"reflect"
"testing"

"github.com/oras-project/oras-go/v3/registry/remote/credentials"
"github.com/sirupsen/logrus"
"github.com/spf13/pflag"
"oras.land/oras-go/v2/registry/remote/auth"
)

var ts *httptest.Server
Expand Down Expand Up @@ -131,7 +131,7 @@ func TestRemote_authClient_RawCredential(t *testing.T) {
if _, err := rand.Read(password); err != nil {
t.Fatalf("unexpected error: %v", err)
}
want := auth.Credential{
want := credentials.Credential{
Username: "mocked^^??oras-@@!#",
Password: base64.StdEncoding.EncodeToString(password),
}
Expand All @@ -143,7 +143,7 @@ func TestRemote_authClient_RawCredential(t *testing.T) {
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
got, err := client.Credential(nil, "")
got, err := client.CredentialFunc(nil, "")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/internal/option/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"fmt"
"strings"

"github.com/oras-project/oras-go/v3"
"github.com/spf13/pflag"
"oras.land/oras-go/v2"
oerrors "oras.land/oras/cmd/oras/internal/errors"
)

Expand Down
Loading
Loading