pull/12725/merge
Eddie Zaneski 2 years ago committed by GitHub
commit 0e32b3acf2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -17,7 +17,6 @@ limitations under the License.
package main // import "helm.sh/helm/v3/cmd/helm" package main // import "helm.sh/helm/v3/cmd/helm"
import ( import (
"fmt"
"io" "io"
"log" "log"
"os" "os"
@ -31,6 +30,7 @@ import (
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cli" "helm.sh/helm/v3/pkg/cli"
helmcmd "helm.sh/helm/v3/pkg/cmd"
"helm.sh/helm/v3/pkg/kube" "helm.sh/helm/v3/pkg/kube"
kubefake "helm.sh/helm/v3/pkg/kube/fake" kubefake "helm.sh/helm/v3/pkg/kube/fake"
"helm.sh/helm/v3/pkg/release" "helm.sh/helm/v3/pkg/release"
@ -43,18 +43,6 @@ func init() {
log.SetFlags(log.Lshortfile) log.SetFlags(log.Lshortfile)
} }
func debug(format string, v ...interface{}) {
if settings.Debug {
format = fmt.Sprintf("[debug] %s\n", format)
log.Output(2, fmt.Sprintf(format, v...))
}
}
func warning(format string, v ...interface{}) {
format = fmt.Sprintf("WARNING: %s\n", format)
fmt.Fprintf(os.Stderr, format, v...)
}
func main() { func main() {
// Setting the name of the app for managedFields in the Kubernetes client. // Setting the name of the app for managedFields in the Kubernetes client.
// It is set here to the full name of "helm" so that renaming of helm to // It is set here to the full name of "helm" so that renaming of helm to
@ -63,16 +51,16 @@ func main() {
kube.ManagedFieldsManager = "helm" kube.ManagedFieldsManager = "helm"
actionConfig := new(action.Configuration) actionConfig := new(action.Configuration)
cmd, err := newRootCmd(actionConfig, os.Stdout, os.Args[1:]) cmd, err := helmcmd.NewRootCmd(actionConfig, settings, os.Stdout, os.Args[1:])
if err != nil { if err != nil {
warning("%+v", err) helmcmd.Warning("%+v", err)
os.Exit(1) os.Exit(1)
} }
// run when each command's execute method is called // run when each command's execute method is called
cobra.OnInitialize(func() { cobra.OnInitialize(func() {
helmDriver := os.Getenv("HELM_DRIVER") helmDriver := os.Getenv("HELM_DRIVER")
if err := actionConfig.Init(settings.RESTClientGetter(), settings.Namespace(), helmDriver, debug); err != nil { if err := actionConfig.Init(settings.RESTClientGetter(), settings.Namespace(), helmDriver, helmcmd.Debug); err != nil {
log.Fatal(err) log.Fatal(err)
} }
if helmDriver == "memory" { if helmDriver == "memory" {
@ -81,10 +69,10 @@ func main() {
}) })
if err := cmd.Execute(); err != nil { if err := cmd.Execute(); err != nil {
debug("%+v", err) helmcmd.Debug("%+v", err)
switch e := err.(type) { switch e := err.(type) {
case pluginError: case helmcmd.PluginError:
os.Exit(e.code) os.Exit(e.Code)
default: default:
os.Exit(1) os.Exit(1)
} }

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -23,7 +23,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require" "helm.sh/helm/v3/pkg/cmd/require"
) )
const completionDesc = ` const completionDesc = `

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -23,9 +23,9 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/chart" "helm.sh/helm/v3/pkg/chart"
"helm.sh/helm/v3/pkg/chartutil" "helm.sh/helm/v3/pkg/chartutil"
"helm.sh/helm/v3/pkg/cmd/require"
"helm.sh/helm/v3/pkg/helmpath" "helm.sh/helm/v3/pkg/helmpath"
) )

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"io" "io"
@ -21,8 +21,8 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cmd/require"
) )
const dependencyDesc = ` const dependencyDesc = `

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -24,8 +24,8 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"k8s.io/client-go/util/homedir" "k8s.io/client-go/util/homedir"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cmd/require"
"helm.sh/helm/v3/pkg/downloader" "helm.sh/helm/v3/pkg/downloader"
"helm.sh/helm/v3/pkg/getter" "helm.sh/helm/v3/pkg/getter"
) )

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"runtime" "runtime"

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"io" "io"
@ -21,8 +21,8 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cmd/require"
"helm.sh/helm/v3/pkg/downloader" "helm.sh/helm/v3/pkg/downloader"
"helm.sh/helm/v3/pkg/getter" "helm.sh/helm/v3/pkg/getter"
) )

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -28,7 +28,7 @@ import (
"golang.org/x/text/cases" "golang.org/x/text/cases"
"golang.org/x/text/language" "golang.org/x/text/language"
"helm.sh/helm/v3/cmd/helm/require" "helm.sh/helm/v3/pkg/cmd/require"
) )
const docsDesc = ` const docsDesc = `

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"testing" "testing"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -23,7 +23,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require" "helm.sh/helm/v3/pkg/cmd/require"
) )
var envHelp = ` var envHelp = `

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"testing" "testing"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"flag" "flag"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"

@ -14,15 +14,15 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"io" "io"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cmd/require"
) )
var getHelp = ` var getHelp = `

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"io" "io"
@ -22,9 +22,9 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cli/output" "helm.sh/helm/v3/pkg/cli/output"
"helm.sh/helm/v3/pkg/cmd/require"
) )
var getAllHelp = ` var getAllHelp = `

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"testing" "testing"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -23,8 +23,8 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cmd/require"
) )
const getHooksHelp = ` const getHooksHelp = `

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"testing" "testing"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -23,8 +23,8 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cmd/require"
) )
var getManifestHelp = ` var getManifestHelp = `

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"testing" "testing"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -23,9 +23,9 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cli/output" "helm.sh/helm/v3/pkg/cli/output"
"helm.sh/helm/v3/pkg/cmd/require"
) )
type metadataWriter struct { type metadataWriter struct {

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"testing" "testing"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -23,8 +23,8 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cmd/require"
) )
var getNotesHelp = ` var getNotesHelp = `

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"testing" "testing"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"testing" "testing"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -23,9 +23,9 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cli/output" "helm.sh/helm/v3/pkg/cli/output"
"helm.sh/helm/v3/pkg/cmd/require"
) )
var getValuesHelp = ` var getValuesHelp = `

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"testing" "testing"

@ -14,14 +14,15 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"bytes" "bytes"
"io" "io"
"os" "os"
"os/exec"
"runtime" // "os/exec"
// "runtime"
"strings" "strings"
"testing" "testing"
@ -97,7 +98,7 @@ func executeActionCommandStdinC(store *storage.Storage, in *os.File, cmd string)
Log: func(format string, v ...interface{}) {}, Log: func(format string, v ...interface{}) {},
} }
root, err := newRootCmd(actionConfig, buf, args) root, err := NewRootCmd(actionConfig, settings, buf, args)
if err != nil { if err != nil {
return nil, "", err return nil, "", err
} }
@ -165,58 +166,59 @@ func testChdir(t *testing.T, dir string) func() {
return func() { os.Chdir(old) } return func() { os.Chdir(old) }
} }
func TestPluginExitCode(t *testing.T) { // TODO(eddiezane): can't call main like this anymore
if os.Getenv("RUN_MAIN_FOR_TESTING") == "1" { // func TestPluginExitCode(t *testing.T) {
os.Args = []string{"helm", "exitwith", "2"} // if os.Getenv("RUN_MAIN_FOR_TESTING") == "1" {
// os.Args = []string{"helm", "exitwith", "2"}
// We DO call helm's main() here. So this looks like a normal `helm` process. //
main() // // We DO call helm's main() here. So this looks like a normal `helm` process.
// main()
// As main calls os.Exit, we never reach this line. //
// But the test called this block of code catches and verifies the exit code. // // As main calls os.Exit, we never reach this line.
return // // But the test called this block of code catches and verifies the exit code.
} // return
// }
// Currently, plugins assume a Linux subsystem. Skip the execution //
// tests until this is fixed // // Currently, plugins assume a Linux subsystem. Skip the execution
if runtime.GOOS != "windows" { // // tests until this is fixed
// Do a second run of this specific test(TestPluginExitCode) with RUN_MAIN_FOR_TESTING=1 set, // if runtime.GOOS != "windows" {
// So that the second run is able to run main() and this first run can verify the exit status returned by that. // // Do a second run of this specific test(TestPluginExitCode) with RUN_MAIN_FOR_TESTING=1 set,
// // // So that the second run is able to run main() and this first run can verify the exit status returned by that.
// This technique originates from https://talks.golang.org/2014/testing.slide#23. // //
cmd := exec.Command(os.Args[0], "-test.run=TestPluginExitCode") // // This technique originates from https://talks.golang.org/2014/testing.slide#23.
cmd.Env = append( // cmd := exec.Command(os.Args[0], "-test.run=TestPluginExitCode")
os.Environ(), // cmd.Env = append(
"RUN_MAIN_FOR_TESTING=1", // os.Environ(),
// See pkg/cli/environment.go for which envvars can be used for configuring these passes // "RUN_MAIN_FOR_TESTING=1",
// and also see plugin_test.go for how a plugin env can be set up. // // See pkg/cli/environment.go for which envvars can be used for configuring these passes
// We just does the same setup as plugin_test.go via envvars // // and also see plugin_test.go for how a plugin env can be set up.
"HELM_PLUGINS=testdata/helmhome/helm/plugins", // // We just does the same setup as plugin_test.go via envvars
"HELM_REPOSITORY_CONFIG=testdata/helmhome/helm/repositories.yaml", // "HELM_PLUGINS=testdata/helmhome/helm/plugins",
"HELM_REPOSITORY_CACHE=testdata/helmhome/helm/repository", // "HELM_REPOSITORY_CONFIG=testdata/helmhome/helm/repositories.yaml",
) // "HELM_REPOSITORY_CACHE=testdata/helmhome/helm/repository",
stdout := &bytes.Buffer{} // )
stderr := &bytes.Buffer{} // stdout := &bytes.Buffer{}
cmd.Stdout = stdout // stderr := &bytes.Buffer{}
cmd.Stderr = stderr // cmd.Stdout = stdout
err := cmd.Run() // cmd.Stderr = stderr
exiterr, ok := err.(*exec.ExitError) // err := cmd.Run()
// exiterr, ok := err.(*exec.ExitError)
if !ok { //
t.Fatalf("Unexpected error returned by os.Exit: %T", err) // if !ok {
} // t.Fatalf("Unexpected error returned by os.Exit: %T", err)
// }
if stdout.String() != "" { //
t.Errorf("Expected no write to stdout: Got %q", stdout.String()) // if stdout.String() != "" {
} // t.Errorf("Expected no write to stdout: Got %q", stdout.String())
// }
expectedStderr := "Error: plugin \"exitwith\" exited with error\n" //
if stderr.String() != expectedStderr { // expectedStderr := "Error: plugin \"exitwith\" exited with error\n"
t.Errorf("Expected %q written to stderr: Got %q", expectedStderr, stderr.String()) // if stderr.String() != expectedStderr {
} // t.Errorf("Expected %q written to stderr: Got %q", expectedStderr, stderr.String())
// }
if exiterr.ExitCode() != 2 { //
t.Errorf("Expected exit code 2: Got %d", exiterr.ExitCode()) // if exiterr.ExitCode() != 2 {
} // t.Errorf("Expected exit code 2: Got %d", exiterr.ExitCode())
} // }
} // }
// }

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -25,10 +25,10 @@ import (
"github.com/gosuri/uitable" "github.com/gosuri/uitable"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/chart" "helm.sh/helm/v3/pkg/chart"
"helm.sh/helm/v3/pkg/cli/output" "helm.sh/helm/v3/pkg/cli/output"
"helm.sh/helm/v3/pkg/cmd/require"
"helm.sh/helm/v3/pkg/release" "helm.sh/helm/v3/pkg/release"
"helm.sh/helm/v3/pkg/releaseutil" "helm.sh/helm/v3/pkg/releaseutil"
helmtime "helm.sh/helm/v3/pkg/time" helmtime "helm.sh/helm/v3/pkg/time"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"context" "context"
@ -30,12 +30,12 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/spf13/pflag" "github.com/spf13/pflag"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/chart" "helm.sh/helm/v3/pkg/chart"
"helm.sh/helm/v3/pkg/chart/loader" "helm.sh/helm/v3/pkg/chart/loader"
"helm.sh/helm/v3/pkg/cli/output" "helm.sh/helm/v3/pkg/cli/output"
"helm.sh/helm/v3/pkg/cli/values" "helm.sh/helm/v3/pkg/cli/values"
"helm.sh/helm/v3/pkg/cmd/require"
"helm.sh/helm/v3/pkg/downloader" "helm.sh/helm/v3/pkg/downloader"
"helm.sh/helm/v3/pkg/getter" "helm.sh/helm/v3/pkg/getter"
"helm.sh/helm/v3/pkg/release" "helm.sh/helm/v3/pkg/release"
@ -211,9 +211,9 @@ func addInstallFlags(cmd *cobra.Command, f *pflag.FlagSet, client *action.Instal
} }
func runInstall(args []string, client *action.Install, valueOpts *values.Options, out io.Writer) (*release.Release, error) { func runInstall(args []string, client *action.Install, valueOpts *values.Options, out io.Writer) (*release.Release, error) {
debug("Original chart version: %q", client.Version) Debug("Original chart version: %q", client.Version)
if client.Version == "" && client.Devel { if client.Version == "" && client.Devel {
debug("setting version to >0.0.0-0") Debug("setting version to >0.0.0-0")
client.Version = ">0.0.0-0" client.Version = ">0.0.0-0"
} }
@ -228,7 +228,7 @@ func runInstall(args []string, client *action.Install, valueOpts *values.Options
return nil, err return nil, err
} }
debug("CHART PATH: %s\n", cp) Debug("CHART PATH: %s\n", cp)
p := getter.All(settings) p := getter.All(settings)
vals, err := valueOpts.MergeValues(p) vals, err := valueOpts.MergeValues(p)
@ -247,7 +247,7 @@ func runInstall(args []string, client *action.Install, valueOpts *values.Options
} }
if chartRequested.Metadata.Deprecated { if chartRequested.Metadata.Deprecated {
warning("This chart is deprecated") Warning("This chart is deprecated")
} }
if req := chartRequested.Metadata.Dependencies; req != nil { if req := chartRequested.Metadata.Dependencies; req != nil {

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -25,9 +25,9 @@ import (
"github.com/gosuri/uitable" "github.com/gosuri/uitable"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cli/output" "helm.sh/helm/v3/pkg/cli/output"
"helm.sh/helm/v3/pkg/cmd/require"
"helm.sh/helm/v3/pkg/release" "helm.sh/helm/v3/pkg/release"
) )
@ -71,7 +71,7 @@ func newListCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
ValidArgsFunction: noCompletions, ValidArgsFunction: noCompletions,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
if client.AllNamespaces { if client.AllNamespaces {
if err := cfg.Init(settings.RESTClientGetter(), "", os.Getenv("HELM_DRIVER"), debug); err != nil { if err := cfg.Init(settings.RESTClientGetter(), "", os.Getenv("HELM_DRIVER"), Debug); err != nil {
return err return err
} }
} }

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"testing" "testing"

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"bytes" "bytes"
@ -39,9 +39,9 @@ const (
pluginDynamicCompletionExecutable = "plugin.complete" pluginDynamicCompletionExecutable = "plugin.complete"
) )
type pluginError struct { type PluginError struct {
error error
code int Code int
} }
// loadPlugins loads plugins into the command list. // loadPlugins loads plugins into the command list.
@ -138,9 +138,9 @@ func callPluginExecutable(pluginName string, main string, argv []string, out io.
if eerr, ok := err.(*exec.ExitError); ok { if eerr, ok := err.(*exec.ExitError); ok {
os.Stderr.Write(eerr.Stderr) os.Stderr.Write(eerr.Stderr)
status := eerr.Sys().(syscall.WaitStatus) status := eerr.Sys().(syscall.WaitStatus)
return pluginError{ return PluginError{
error: errors.Errorf("plugin %q exited with error", pluginName), error: errors.Errorf("plugin %q exited with error", pluginName),
code: status.ExitStatus(), Code: status.ExitStatus(),
} }
} }
return err return err

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"io" "io"
@ -57,7 +57,7 @@ func runHook(p *plugin.Plugin, event string) error {
// I think its ... ¯\_(ツ)_/¯ // I think its ... ¯\_(ツ)_/¯
// prog := exec.Command("cmd", "/C", p.Metadata.Hooks.Install()) // prog := exec.Command("cmd", "/C", p.Metadata.Hooks.Install())
debug("running %s hook: %s", event, prog) Debug("running %s hook: %s", event, prog)
plugin.SetupPluginEnv(settings, p.Metadata.Name, p.Dir) plugin.SetupPluginEnv(settings, p.Metadata.Name, p.Dir)
prog.Stdout, prog.Stderr = os.Stdout, os.Stderr prog.Stdout, prog.Stderr = os.Stdout, os.Stderr

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -22,7 +22,7 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require" "helm.sh/helm/v3/pkg/cmd/require"
"helm.sh/helm/v3/pkg/plugin" "helm.sh/helm/v3/pkg/plugin"
"helm.sh/helm/v3/pkg/plugin/installer" "helm.sh/helm/v3/pkg/plugin/installer"
) )
@ -79,7 +79,7 @@ func (o *pluginInstallOptions) run(out io.Writer) error {
return err return err
} }
debug("loading plugin from %s", i.Path()) Debug("loading plugin from %s", i.Path())
p, err := plugin.LoadDir(i.Path()) p, err := plugin.LoadDir(i.Path())
if err != nil { if err != nil {
return errors.Wrap(err, "plugin is installed but unusable") return errors.Wrap(err, "plugin is installed but unusable")

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -32,7 +32,7 @@ func newPluginListCmd(out io.Writer) *cobra.Command {
Short: "list installed Helm plugins", Short: "list installed Helm plugins",
ValidArgsFunction: noCompletions, ValidArgsFunction: noCompletions,
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
debug("pluginDirs: %s", settings.PluginsDirectory) Debug("pluginDirs: %s", settings.PluginsDirectory)
plugins, err := plugin.FindPlugins(settings.PluginsDirectory) plugins, err := plugin.FindPlugins(settings.PluginsDirectory)
if err != nil { if err != nil {
return err return err

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"bytes" "bytes"
@ -143,12 +143,12 @@ func TestLoadPlugins(t *testing.T) {
if runtime.GOOS != "windows" { if runtime.GOOS != "windows" {
if err := pp.RunE(pp, tt.args); err != nil { if err := pp.RunE(pp, tt.args); err != nil {
if tt.code > 0 { if tt.code > 0 {
perr, ok := err.(pluginError) perr, ok := err.(PluginError)
if !ok { if !ok {
t.Errorf("Expected %s to return pluginError: got %v(%T)", tt.use, err, err) t.Errorf("Expected %s to return pluginError: got %v(%T)", tt.use, err, err)
} }
if perr.code != tt.code { if perr.Code != tt.code {
t.Errorf("Expected %s to return %d: got %d", tt.use, tt.code, perr.code) t.Errorf("Expected %s to return %d: got %d", tt.use, tt.code, perr.Code)
} }
} else { } else {
t.Errorf("Error running %s: %+v", tt.use, err) t.Errorf("Error running %s: %+v", tt.use, err)
@ -218,12 +218,12 @@ func TestLoadPluginsWithSpace(t *testing.T) {
if runtime.GOOS != "windows" { if runtime.GOOS != "windows" {
if err := pp.RunE(pp, tt.args); err != nil { if err := pp.RunE(pp, tt.args); err != nil {
if tt.code > 0 { if tt.code > 0 {
perr, ok := err.(pluginError) perr, ok := err.(PluginError)
if !ok { if !ok {
t.Errorf("Expected %s to return pluginError: got %v(%T)", tt.use, err, err) t.Errorf("Expected %s to return pluginError: got %v(%T)", tt.use, err, err)
} }
if perr.code != tt.code { if perr.Code != tt.code {
t.Errorf("Expected %s to return %d: got %d", tt.use, tt.code, perr.code) t.Errorf("Expected %s to return %d: got %d", tt.use, tt.code, perr.Code)
} }
} else { } else {
t.Errorf("Error running %s: %+v", tt.use, err) t.Errorf("Error running %s: %+v", tt.use, err)

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -60,7 +60,7 @@ func (o *pluginUninstallOptions) complete(args []string) error {
} }
func (o *pluginUninstallOptions) run(out io.Writer) error { func (o *pluginUninstallOptions) run(out io.Writer) error {
debug("loading installed plugins from %s", settings.PluginsDirectory) Debug("loading installed plugins from %s", settings.PluginsDirectory)
plugins, err := plugin.FindPlugins(settings.PluginsDirectory) plugins, err := plugin.FindPlugins(settings.PluginsDirectory)
if err != nil { if err != nil {
return err return err

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -62,7 +62,7 @@ func (o *pluginUpdateOptions) complete(args []string) error {
func (o *pluginUpdateOptions) run(out io.Writer) error { func (o *pluginUpdateOptions) run(out io.Writer) error {
installer.Debug = settings.Debug installer.Debug = settings.Debug
debug("loading installed plugins from %s", settings.PluginsDirectory) Debug("loading installed plugins from %s", settings.PluginsDirectory)
plugins, err := plugin.FindPlugins(settings.PluginsDirectory) plugins, err := plugin.FindPlugins(settings.PluginsDirectory)
if err != nil { if err != nil {
return err return err
@ -104,7 +104,7 @@ func updatePlugin(p *plugin.Plugin) error {
return err return err
} }
debug("loading plugin from %s", i.Path()) Debug("loading plugin from %s", i.Path())
updatedPlugin, err := plugin.LoadDir(i.Path()) updatedPlugin, err := plugin.LoadDir(i.Path())
if err != nil { if err != nil {
return err return err

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"io" "io"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -23,8 +23,8 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cmd/require"
) )
const pullDesc = ` const pullDesc = `
@ -60,7 +60,7 @@ func newPullCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
client.Settings = settings client.Settings = settings
if client.Version == "" && client.Devel { if client.Version == "" && client.Devel {
debug("setting version to >0.0.0-0") Debug("setting version to >0.0.0-0")
client.Version = ">0.0.0-0" client.Version = ">0.0.0-0"
} }

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -22,8 +22,8 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cmd/require"
"helm.sh/helm/v3/pkg/pusher" "helm.sh/helm/v3/pkg/pusher"
) )

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"testing" "testing"

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"io" "io"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"bufio" "bufio"
@ -27,8 +27,8 @@ import (
"github.com/moby/term" "github.com/moby/term"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cmd/require"
) )
const registryLoginDesc = ` const registryLoginDesc = `
@ -119,7 +119,7 @@ func getUsernamePassword(usernameOpt string, passwordOpt string, passwordFromStd
} }
} }
} else { } else {
warning("Using --password via the CLI is insecure. Use --password-stdin.") Warning("Using --password via the CLI is insecure. Use --password-stdin.")
} }
return username, password, nil return username, password, nil

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"testing" "testing"

@ -14,15 +14,15 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"io" "io"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cmd/require"
) )
const registryLogoutDesc = ` const registryLogoutDesc = `

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"testing" "testing"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -25,9 +25,9 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cli/output" "helm.sh/helm/v3/pkg/cli/output"
"helm.sh/helm/v3/pkg/cmd/require"
) )
const releaseTestHelp = ` const releaseTestHelp = `

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"testing" "testing"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"io" "io"
@ -23,7 +23,7 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require" "helm.sh/helm/v3/pkg/cmd/require"
) )
var repoHelm = ` var repoHelm = `

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"context" "context"
@ -31,7 +31,7 @@ import (
"golang.org/x/term" "golang.org/x/term"
"sigs.k8s.io/yaml" "sigs.k8s.io/yaml"
"helm.sh/helm/v3/cmd/helm/require" "helm.sh/helm/v3/pkg/cmd/require"
"helm.sh/helm/v3/pkg/getter" "helm.sh/helm/v3/pkg/getter"
"helm.sh/helm/v3/pkg/repo" "helm.sh/helm/v3/pkg/repo"
) )

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"io" "io"
@ -24,7 +24,7 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require" "helm.sh/helm/v3/pkg/cmd/require"
"helm.sh/helm/v3/pkg/repo" "helm.sh/helm/v3/pkg/repo"
) )

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"bytes" "bytes"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -24,8 +24,8 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/cli/output" "helm.sh/helm/v3/pkg/cli/output"
"helm.sh/helm/v3/pkg/cmd/require"
"helm.sh/helm/v3/pkg/repo" "helm.sh/helm/v3/pkg/repo"
) )

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"testing" "testing"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -25,7 +25,7 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require" "helm.sh/helm/v3/pkg/cmd/require"
"helm.sh/helm/v3/pkg/helmpath" "helm.sh/helm/v3/pkg/helmpath"
"helm.sh/helm/v3/pkg/repo" "helm.sh/helm/v3/pkg/repo"
) )

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"bytes" "bytes"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"testing" "testing"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -24,7 +24,7 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require" "helm.sh/helm/v3/pkg/cmd/require"
"helm.sh/helm/v3/pkg/getter" "helm.sh/helm/v3/pkg/getter"
"helm.sh/helm/v3/pkg/repo" "helm.sh/helm/v3/pkg/repo"
) )

@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"bytes" "bytes"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -24,8 +24,8 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cmd/require"
) )
const rollbackDesc = ` const rollbackDesc = `

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main // import "helm.sh/helm/v3/cmd/helm" package cmd // import "helm.sh/helm/v3/cmd/helm"
import ( import (
"context" "context"
@ -30,6 +30,7 @@ import (
"k8s.io/client-go/tools/clientcmd" "k8s.io/client-go/tools/clientcmd"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cli"
"helm.sh/helm/v3/pkg/registry" "helm.sh/helm/v3/pkg/registry"
"helm.sh/helm/v3/pkg/repo" "helm.sh/helm/v3/pkg/repo"
) )
@ -87,7 +88,23 @@ By default, the default directories depend on the Operating System. The defaults
| Windows | %TEMP%\helm | %APPDATA%\helm | %APPDATA%\helm | | Windows | %TEMP%\helm | %APPDATA%\helm | %APPDATA%\helm |
` `
func newRootCmd(actionConfig *action.Configuration, out io.Writer, args []string) (*cobra.Command, error) { var settings *cli.EnvSettings
func Debug(format string, v ...interface{}) {
if settings.Debug {
format = fmt.Sprintf("[debug] %s\n", format)
log.Output(2, fmt.Sprintf(format, v...))
}
}
func Warning(format string, v ...interface{}) {
format = fmt.Sprintf("WARNING: %s\n", format)
fmt.Fprintf(os.Stderr, format, v...)
}
func NewRootCmd(actionConfig *action.Configuration, settingsIn *cli.EnvSettings, out io.Writer, args []string) (*cobra.Command, error) {
settings = settingsIn
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "helm", Use: "helm",
Short: "The Helm package manager for Kubernetes.", Short: "The Helm package manager for Kubernetes.",

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"os" "os"

@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"os" "os"
@ -50,9 +50,9 @@ func checkPerms() {
perm := fi.Mode().Perm() perm := fi.Mode().Perm()
if perm&0040 > 0 { if perm&0040 > 0 {
warning("Kubernetes configuration file is group-readable. This is insecure. Location: %s", kc) Warning("Kubernetes configuration file is group-readable. This is insecure. Location: %s", kc)
} }
if perm&0004 > 0 { if perm&0004 > 0 {
warning("Kubernetes configuration file is world-readable. This is insecure. Location: %s", kc) Warning("Kubernetes configuration file is world-readable. This is insecure. Location: %s", kc)
} }
} }

@ -16,7 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"bytes" "bytes"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
func checkPerms() { func checkPerms() {
// Not yet implemented on Windows. If you know how to do a comprehensive perms // Not yet implemented on Windows. If you know how to do a comprehensive perms

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"io" "io"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -89,7 +89,7 @@ func (o *searchHubOptions) run(out io.Writer, args []string) error {
q := strings.Join(args, " ") q := strings.Join(args, " ")
results, err := c.Search(q) results, err := c.Search(q)
if err != nil { if err != nil {
debug("%s", err) Debug("%s", err)
return fmt.Errorf("unable to perform search against %q", o.searchEndpoint) return fmt.Errorf("unable to perform search against %q", o.searchEndpoint)
} }

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"bufio" "bufio"
@ -30,8 +30,8 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/search"
"helm.sh/helm/v3/pkg/cli/output" "helm.sh/helm/v3/pkg/cli/output"
"helm.sh/helm/v3/pkg/cmd/search"
"helm.sh/helm/v3/pkg/helmpath" "helm.sh/helm/v3/pkg/helmpath"
"helm.sh/helm/v3/pkg/repo" "helm.sh/helm/v3/pkg/repo"
) )
@ -130,17 +130,17 @@ func (o *searchRepoOptions) run(out io.Writer, args []string) error {
} }
func (o *searchRepoOptions) setupSearchedVersion() { func (o *searchRepoOptions) setupSearchedVersion() {
debug("Original chart version: %q", o.version) Debug("Original chart version: %q", o.version)
if o.version != "" { if o.version != "" {
return return
} }
if o.devel { // search for releases and prereleases (alpha, beta, and release candidate releases). if o.devel { // search for releases and prereleases (alpha, beta, and release candidate releases).
debug("setting version to >0.0.0-0") Debug("setting version to >0.0.0-0")
o.version = ">0.0.0-0" o.version = ">0.0.0-0"
} else { // search only for stable releases, prerelease versions will be skip } else { // search only for stable releases, prerelease versions will be skip
debug("setting version to >0.0.0") Debug("setting version to >0.0.0")
o.version = ">0.0.0" o.version = ">0.0.0"
} }
} }
@ -189,8 +189,8 @@ func (o *searchRepoOptions) buildIndex() (*search.Index, error) {
f := filepath.Join(o.repoCacheDir, helmpath.CacheIndexFile(n)) f := filepath.Join(o.repoCacheDir, helmpath.CacheIndexFile(n))
ind, err := repo.LoadIndexFile(f) ind, err := repo.LoadIndexFile(f)
if err != nil { if err != nil {
warning("Repo %q is corrupt or missing. Try 'helm repo update'.", n) Warning("Repo %q is corrupt or missing. Try 'helm repo update'.", n)
warning("%s", err) Warning("%s", err)
continue continue
} }

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"testing" "testing"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import "testing" import "testing"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"
@ -23,8 +23,8 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cmd/require"
) )
const showDesc = ` const showDesc = `
@ -212,9 +212,9 @@ func addShowFlags(subCmd *cobra.Command, client *action.Show) {
} }
func runShow(args []string, client *action.Show) (string, error) { func runShow(args []string, client *action.Show) (string, error) {
debug("Original chart version: %q", client.Version) Debug("Original chart version: %q", client.Version)
if client.Version == "" && client.Devel { if client.Version == "" && client.Devel {
debug("setting version to >0.0.0-0") Debug("setting version to >0.0.0-0")
client.Version = ">0.0.0-0" client.Version = ">0.0.0-0"
} }

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"bytes" "bytes"
@ -28,10 +28,10 @@ import (
"k8s.io/kubectl/pkg/cmd/get" "k8s.io/kubectl/pkg/cmd/get"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/chartutil" "helm.sh/helm/v3/pkg/chartutil"
"helm.sh/helm/v3/pkg/cli/output" "helm.sh/helm/v3/pkg/cli/output"
"helm.sh/helm/v3/pkg/cmd/require"
"helm.sh/helm/v3/pkg/release" "helm.sh/helm/v3/pkg/release"
) )

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"testing" "testing"

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"bytes" "bytes"
@ -31,10 +31,10 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"helm.sh/helm/v3/cmd/helm/require"
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/chartutil" "helm.sh/helm/v3/pkg/chartutil"
"helm.sh/helm/v3/pkg/cli/values" "helm.sh/helm/v3/pkg/cli/values"
"helm.sh/helm/v3/pkg/cmd/require"
"helm.sh/helm/v3/pkg/releaseutil" "helm.sh/helm/v3/pkg/releaseutil"
) )

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package main package cmd
import ( import (
"fmt" "fmt"

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save