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 committed May 7, 2021
1 parent 43853ea commit d0ceda7
Show file tree
Hide file tree
Showing 10 changed files with 309 additions and 61 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
19 changes: 9 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ go 1.16
require (
github.com/BurntSushi/toml v0.3.1
github.com/DATA-DOG/go-sqlmock v1.5.0
github.com/Masterminds/goutils v1.1.1
github.com/Masterminds/semver/v3 v3.1.1
github.com/Masterminds/sprig/v3 v3.2.2
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.10.0
github.com/docker/distribution v2.7.1+incompatible
github.com/docker/docker v1.4.2-0.20200203170920-46ec8731fbce
github.com/docker/docker v17.12.0-ce-rc1.0.20200618181300-9dc6525e6118+incompatible
github.com/docker/go-units v0.4.0
github.com/evanphx/json-patch v4.9.0+incompatible
github.com/gobwas/glob v0.2.3
Expand All @@ -27,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 @@ -35,14 +34,14 @@ 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-20201221181555-eec23a3978ad
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221
k8s.io/api v0.20.4
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1
k8s.io/api v0.20.6
k8s.io/apiextensions-apiserver v0.20.4
k8s.io/apimachinery v0.20.4
k8s.io/apiserver v0.20.4
k8s.io/apimachinery v0.20.6
k8s.io/apiserver v0.20.6
k8s.io/cli-runtime v0.20.4
k8s.io/client-go v0.20.4
k8s.io/client-go v0.20.6
k8s.io/klog/v2 v2.8.0
k8s.io/kubectl v0.20.4
sigs.k8s.io/yaml v1.2.0
Expand Down
329 changes: 289 additions & 40 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 d0ceda7

Please sign in to comment.