move experimental actions to new internal package

Signed-off-by: Josh Dolitsky <josh@dolit.ski>
pull/9782/head
Josh Dolitsky 4 years ago
parent 8f60ee76a5
commit eba63beab1
No known key found for this signature in database
GPG Key ID: B2B93673243A65FB

@ -23,6 +23,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require" "helm.sh/helm/v3/cmd/helm/require"
experimental "helm.sh/helm/v3/internal/experimental/action"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
) )
@ -34,7 +35,7 @@ provenance file, which will also be uploaded.
` `
func newPushCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { func newPushCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
client := action.NewPushWithOpts(action.WithPushConfig(cfg)) client := experimental.NewPushWithOpts(experimental.WithPushConfig(cfg))
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "push [chart] [remote]", Use: "push [chart] [remote]",

@ -29,6 +29,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require" "helm.sh/helm/v3/cmd/helm/require"
experimental "helm.sh/helm/v3/internal/experimental/action"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
) )
@ -54,7 +55,7 @@ func newRegistryLoginCmd(cfg *action.Configuration, out io.Writer) *cobra.Comman
return err return err
} }
return action.NewRegistryLogin(cfg).Run(out, hostname, username, password, insecureOpt) return experimental.NewRegistryLogin(cfg).Run(out, hostname, username, password, insecureOpt)
}, },
} }
@ -67,7 +68,7 @@ func newRegistryLoginCmd(cfg *action.Configuration, out io.Writer) *cobra.Comman
return cmd return cmd
} }
// Adapted from https://github.com/deislabs/oras // Adapted from the ORAS project
func getUsernamePassword(usernameOpt string, passwordOpt string, passwordFromStdinOpt bool) (string, string, error) { func getUsernamePassword(usernameOpt string, passwordOpt string, passwordFromStdinOpt bool) (string, string, error) {
var err error var err error
username := usernameOpt username := usernameOpt
@ -110,7 +111,7 @@ func getUsernamePassword(usernameOpt string, passwordOpt string, passwordFromStd
return username, password, nil return username, password, nil
} }
// Copied/adapted from https://github.com/deislabs/oras // Copied/adapted from the ORAS project
func readLine(prompt string, silent bool) (string, error) { func readLine(prompt string, silent bool) (string, error) {
fmt.Print(prompt) fmt.Print(prompt)
if silent { if silent {

@ -22,6 +22,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require" "helm.sh/helm/v3/cmd/helm/require"
experimental "helm.sh/helm/v3/internal/experimental/action"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
) )
@ -38,7 +39,7 @@ func newRegistryLogoutCmd(cfg *action.Configuration, out io.Writer) *cobra.Comma
Hidden: !FeatureGateOCI.IsEnabled(), Hidden: !FeatureGateOCI.IsEnabled(),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
hostname := args[0] hostname := args[0]
return action.NewRegistryLogout(cfg).Run(out, hostname) return experimental.NewRegistryLogout(cfg).Run(out, hostname)
}, },
} }
} }

@ -21,6 +21,7 @@ import (
"helm.sh/helm/v3/internal/experimental/pusher" "helm.sh/helm/v3/internal/experimental/pusher"
"helm.sh/helm/v3/internal/experimental/uploader" "helm.sh/helm/v3/internal/experimental/uploader"
"helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cli" "helm.sh/helm/v3/pkg/cli"
) )
@ -30,14 +31,14 @@ import (
type Push struct { type Push struct {
Settings *cli.EnvSettings Settings *cli.EnvSettings
WithProv bool WithProv bool
cfg *Configuration cfg *action.Configuration
} }
// PushOpt is a type of function that sets options for a push action. // PushOpt is a type of function that sets options for a push action.
type PushOpt func(*Push) type PushOpt func(*Push)
// WithPushConfig sets the cfg field on the push configuration object. // WithPushConfig sets the cfg field on the push configuration object.
func WithPushConfig(cfg *Configuration) PushOpt { func WithPushConfig(cfg *action.Configuration) PushOpt {
return func(p *Push) { return func(p *Push) {
p.cfg = cfg p.cfg = cfg
} }

@ -20,15 +20,16 @@ import (
"io" "io"
"helm.sh/helm/v3/internal/experimental/registry" "helm.sh/helm/v3/internal/experimental/registry"
"helm.sh/helm/v3/pkg/action"
) )
// RegistryLogin performs a registry login operation. // RegistryLogin performs a registry login operation.
type RegistryLogin struct { type RegistryLogin struct {
cfg *Configuration cfg *action.Configuration
} }
// NewRegistryLogin creates a new RegistryLogin object with the given configuration. // NewRegistryLogin creates a new RegistryLogin object with the given configuration.
func NewRegistryLogin(cfg *Configuration) *RegistryLogin { func NewRegistryLogin(cfg *action.Configuration) *RegistryLogin {
return &RegistryLogin{ return &RegistryLogin{
cfg: cfg, cfg: cfg,
} }

@ -18,15 +18,17 @@ package action
import ( import (
"io" "io"
"helm.sh/helm/v3/pkg/action"
) )
// RegistryLogout performs a registry login operation. // RegistryLogout performs a registry login operation.
type RegistryLogout struct { type RegistryLogout struct {
cfg *Configuration cfg *action.Configuration
} }
// NewRegistryLogout creates a new RegistryLogout object with the given configuration. // NewRegistryLogout creates a new RegistryLogout object with the given configuration.
func NewRegistryLogout(cfg *Configuration) *RegistryLogout { func NewRegistryLogout(cfg *action.Configuration) *RegistryLogout {
return &RegistryLogout{ return &RegistryLogout{
cfg: cfg, cfg: cfg,
} }
Loading…
Cancel
Save