Skip to content

Commit

Permalink
Migrate to oras-go library
Browse files Browse the repository at this point in the history
see oras-project/oras#265

Signed-off-by: Nicolas De Loof <[email protected]>
  • Loading branch information
ndeloof authored and tylerauerbeck committed Aug 5, 2021
1 parent 28f919b commit 3422421
Show file tree
Hide file tree
Showing 10 changed files with 281 additions and 34 deletions.
4 changes: 2 additions & 2 deletions cmd/helm/registry_login.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func newRegistryLoginCmd(cfg *action.Configuration, out io.Writer) *cobra.Comman
return cmd
}

// Adapted from https://github.com/deislabs/oras
// Adapted from https://github.com/oras-project/oras-go
func getUsernamePassword(usernameOpt string, passwordOpt string, passwordFromStdinOpt bool) (string, string, error) {
var err error
username := usernameOpt
Expand Down Expand Up @@ -110,7 +110,7 @@ func getUsernamePassword(usernameOpt string, passwordOpt string, passwordFromStd
return username, password, nil
}

// Copied/adapted from https://github.com/deislabs/oras
// Copied/adapted from https://github.com/oras-project/oras-go
func readLine(prompt string, silent bool) (string, error) {
fmt.Print(prompt)
if silent {
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ require (
github.com/Masterminds/squirrel v1.5.0
github.com/Masterminds/vcs v1.13.1
github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535
github.com/containerd/containerd v1.4.4
github.com/containerd/containerd v1.5.0-rc.3
github.com/cyphar/filepath-securejoin v0.2.2
github.com/deislabs/oras v0.11.1
github.com/docker/distribution v2.7.1+incompatible
github.com/docker/docker v17.12.0-ce-rc1.0.20200618181300-9dc6525e6118+incompatible
github.com/docker/go-units v0.4.0
Expand All @@ -26,6 +25,7 @@ require (
github.com/mitchellh/copystructure v1.1.1
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.0.1
github.com/oras-project/oras-go v0.1.0
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
github.com/pkg/errors v0.9.1
github.com/rubenv/sql-migrate v0.0.0-20200616145509-8d140a17f351
Expand All @@ -34,7 +34,7 @@ require (
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.7.0
github.com/xeipuuv/gojsonschema v1.2.0
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d
k8s.io/api v0.21.0
k8s.io/apiextensions-apiserver v0.21.0
Expand Down
287 changes: 267 additions & 20 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion internal/experimental/registry/authorizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package registry // import "helm.sh/helm/v3/internal/experimental/registry"

import (
"github.com/deislabs/oras/pkg/auth"
"github.com/oras-project/oras-go/pkg/auth"
)

type (
Expand Down
2 changes: 1 addition & 1 deletion internal/experimental/registry/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import (

"github.com/containerd/containerd/content"
"github.com/containerd/containerd/errdefs"
orascontent "github.com/deislabs/oras/pkg/content"
digest "github.com/opencontainers/go-digest"
specs "github.com/opencontainers/image-spec/specs-go"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
orascontent "github.com/oras-project/oras-go/pkg/content"
"github.com/pkg/errors"

"helm.sh/helm/v3/pkg/chart"
Expand Down
6 changes: 3 additions & 3 deletions internal/experimental/registry/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ import (
"net/http"
"sort"

auth "github.com/deislabs/oras/pkg/auth/docker"
"github.com/deislabs/oras/pkg/content"
"github.com/deislabs/oras/pkg/oras"
"github.com/gosuri/uitable"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
auth "github.com/oras-project/oras-go/pkg/auth/docker"
"github.com/oras-project/oras-go/pkg/content"
"github.com/oras-project/oras-go/pkg/oras"
"github.com/pkg/errors"

"helm.sh/helm/v3/pkg/chart"
Expand Down
2 changes: 1 addition & 1 deletion internal/experimental/registry/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ import (
"time"

"github.com/containerd/containerd/errdefs"
auth "github.com/deislabs/oras/pkg/auth/docker"
"github.com/docker/distribution/configuration"
"github.com/docker/distribution/registry"
_ "github.com/docker/distribution/registry/auth/htpasswd"
_ "github.com/docker/distribution/registry/storage/driver/inmemory"
auth "github.com/oras-project/oras-go/pkg/auth/docker"
"github.com/phayes/freeport"
"github.com/stretchr/testify/suite"
"golang.org/x/crypto/bcrypt"
Expand Down
2 changes: 1 addition & 1 deletion internal/experimental/registry/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
"io"
"time"

orascontext "github.com/deislabs/oras/pkg/context"
units "github.com/docker/go-units"
orascontext "github.com/oras-project/oras-go/pkg/context"
"github.com/sirupsen/logrus"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/action/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"path/filepath"
"testing"

dockerauth "github.com/deislabs/oras/pkg/auth/docker"
dockerauth "github.com/oras-project/oras-go/pkg/auth/docker"
fakeclientset "k8s.io/client-go/kubernetes/fake"

"helm.sh/helm/v3/internal/experimental/registry"
Expand Down
2 changes: 1 addition & 1 deletion pkg/repo/repotest/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ import (
"testing"
"time"

auth "github.com/deislabs/oras/pkg/auth/docker"
"github.com/docker/distribution/configuration"
"github.com/docker/distribution/registry"
_ "github.com/docker/distribution/registry/auth/htpasswd" // used for docker test registry
_ "github.com/docker/distribution/registry/storage/driver/inmemory" // used for docker test registry
auth "github.com/oras-project/oras-go/pkg/auth/docker"
"github.com/phayes/freeport"
"golang.org/x/crypto/bcrypt"
"sigs.k8s.io/yaml"
Expand Down

0 comments on commit 3422421

Please sign in to comment.