mirror of https://github.com/helm/helm
commit
ee66954001
@ -0,0 +1,114 @@
|
||||
/*
|
||||
Copyright 2017 The Kubernetes Authors All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"k8s.io/helm/pkg/helm/helmpath"
|
||||
"k8s.io/helm/pkg/plugin"
|
||||
"k8s.io/helm/pkg/plugin/installer"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
type pluginUpdateCmd struct {
|
||||
names []string
|
||||
home helmpath.Home
|
||||
out io.Writer
|
||||
}
|
||||
|
||||
func newPluginUpdateCmd(out io.Writer) *cobra.Command {
|
||||
pcmd := &pluginUpdateCmd{out: out}
|
||||
cmd := &cobra.Command{
|
||||
Use: "update <plugin>...",
|
||||
Short: "update one or more Helm plugins",
|
||||
PreRunE: func(cmd *cobra.Command, args []string) error {
|
||||
return pcmd.complete(args)
|
||||
},
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
return pcmd.run()
|
||||
},
|
||||
}
|
||||
return cmd
|
||||
}
|
||||
|
||||
func (pcmd *pluginUpdateCmd) complete(args []string) error {
|
||||
if len(args) == 0 {
|
||||
return errors.New("please provide plugin name to update")
|
||||
}
|
||||
pcmd.names = args
|
||||
pcmd.home = settings.Home
|
||||
return nil
|
||||
}
|
||||
|
||||
func (pcmd *pluginUpdateCmd) run() error {
|
||||
installer.Debug = settings.Debug
|
||||
plugdirs := pluginDirs(pcmd.home)
|
||||
debug("loading installed plugins from %s", plugdirs)
|
||||
plugins, err := findPlugins(plugdirs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var errorPlugins []string
|
||||
|
||||
for _, name := range pcmd.names {
|
||||
if found := findPlugin(plugins, name); found != nil {
|
||||
if err := updatePlugin(found, pcmd.home); err != nil {
|
||||
errorPlugins = append(errorPlugins, fmt.Sprintf("Failed to update plugin %s, got error (%v)", name, err))
|
||||
} else {
|
||||
fmt.Fprintf(pcmd.out, "Updated plugin: %s\n", name)
|
||||
}
|
||||
} else {
|
||||
errorPlugins = append(errorPlugins, fmt.Sprintf("Plugin: %s not found", name))
|
||||
}
|
||||
}
|
||||
if len(errorPlugins) > 0 {
|
||||
return fmt.Errorf(strings.Join(errorPlugins, "\n"))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func updatePlugin(p *plugin.Plugin, home helmpath.Home) error {
|
||||
exactLocation, err := filepath.EvalSymlinks(p.Dir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
absExactLocation, err := filepath.Abs(exactLocation)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
i, err := installer.FindSource(absExactLocation, home)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := installer.Update(i); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
debug("loading plugin from %s", i.Path())
|
||||
updatedPlugin, err := plugin.LoadDir(i.Path())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return runHook(updatedPlugin, plugin.Update, home)
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
/*
|
||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"k8s.io/helm/pkg/proto/hapi/release"
|
||||
)
|
||||
|
||||
func TestReleaseTesting(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
args []string
|
||||
flags []string
|
||||
responses map[string]release.TestRun_Status
|
||||
fail bool
|
||||
}{
|
||||
{
|
||||
name: "basic test",
|
||||
args: []string{"example-release"},
|
||||
flags: []string{},
|
||||
responses: map[string]release.TestRun_Status{"PASSED: green lights everywhere": release.TestRun_SUCCESS},
|
||||
fail: false,
|
||||
},
|
||||
{
|
||||
name: "test failure",
|
||||
args: []string{"example-fail"},
|
||||
flags: []string{},
|
||||
responses: map[string]release.TestRun_Status{"FAILURE: red lights everywhere": release.TestRun_FAILURE},
|
||||
fail: true,
|
||||
},
|
||||
{
|
||||
name: "test unknown",
|
||||
args: []string{"example-unknown"},
|
||||
flags: []string{},
|
||||
responses: map[string]release.TestRun_Status{"UNKNOWN: yellow lights everywhere": release.TestRun_UNKNOWN},
|
||||
fail: false,
|
||||
},
|
||||
{
|
||||
name: "test error",
|
||||
args: []string{"example-error"},
|
||||
flags: []string{},
|
||||
responses: map[string]release.TestRun_Status{"ERROR: yellow lights everywhere": release.TestRun_FAILURE},
|
||||
fail: true,
|
||||
},
|
||||
{
|
||||
name: "test running",
|
||||
args: []string{"example-running"},
|
||||
flags: []string{},
|
||||
responses: map[string]release.TestRun_Status{"RUNNING: things are happpeningggg": release.TestRun_RUNNING},
|
||||
fail: false,
|
||||
},
|
||||
{
|
||||
name: "multiple tests example",
|
||||
args: []string{"example-suite"},
|
||||
flags: []string{},
|
||||
responses: map[string]release.TestRun_Status{
|
||||
"RUNNING: things are happpeningggg": release.TestRun_RUNNING,
|
||||
"PASSED: party time": release.TestRun_SUCCESS,
|
||||
"RUNNING: things are happening again": release.TestRun_RUNNING,
|
||||
"FAILURE: good thing u checked :)": release.TestRun_FAILURE,
|
||||
"RUNNING: things are happpeningggg yet again": release.TestRun_RUNNING,
|
||||
"PASSED: feel free to party again": release.TestRun_SUCCESS},
|
||||
fail: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
c := &fakeReleaseClient{responses: tt.responses}
|
||||
|
||||
buf := bytes.NewBuffer(nil)
|
||||
cmd := newReleaseTestCmd(c, buf)
|
||||
cmd.ParseFlags(tt.flags)
|
||||
|
||||
err := cmd.RunE(cmd, tt.args)
|
||||
if err == nil && tt.fail {
|
||||
t.Errorf("%q did not fail but should have failed", tt.name)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
if tt.fail {
|
||||
continue
|
||||
} else {
|
||||
t.Errorf("%q reported error: %s", tt.name, err)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
@ -0,0 +1,3 @@
|
||||
description: A Helm chart for Kubernetes
|
||||
name: chart-missing-deps
|
||||
version: 0.1.0
|
@ -0,0 +1,21 @@
|
||||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
@ -0,0 +1,3 @@
|
||||
description: A Helm chart for Kubernetes
|
||||
name: reqsubchart
|
||||
version: 0.1.0
|
@ -0,0 +1,4 @@
|
||||
# Default values for reqsubchart.
|
||||
# This is a YAML-formatted file.
|
||||
# Declare name/value pairs to be passed into your templates.
|
||||
# name: value
|
@ -0,0 +1,4 @@
|
||||
dependencies:
|
||||
- name: reqsubchart
|
||||
version: 0.1.0
|
||||
repository: "https://example.com/charts"
|
@ -0,0 +1,4 @@
|
||||
# Default values for reqtest.
|
||||
# This is a YAML-formatted file.
|
||||
# Declare name/value pairs to be passed into your templates.
|
||||
# name: value
|
@ -0,0 +1,15 @@
|
||||
# Chart Repositories: Frequently Asked Questions
|
||||
|
||||
This section tracks some of the more frequently encountered issues with using chart repositories.
|
||||
|
||||
**We'd love your help** making this document better. To add, correct, or remove
|
||||
information, [file an issue](https://github.com/kubernetes/helm/issues) or
|
||||
send us a pull request.
|
||||
|
||||
## Fetching
|
||||
|
||||
**Q: Why do I get a `unsupported protocol scheme ""` error when trying to fetch a chart from my custom repo?**
|
||||
|
||||
A: This is likely caused by you creating your chart repo index without specifying the `--url` flag.
|
||||
Try recreating your `index.yaml` file with a command like `heml repo index --url http://my-repo/charts .`,
|
||||
and then re-uploading it to your custom charts repo.
|
@ -0,0 +1,27 @@
|
||||
## helm plugin update
|
||||
|
||||
update one or more Helm plugins
|
||||
|
||||
### Synopsis
|
||||
|
||||
|
||||
update one or more Helm plugins
|
||||
|
||||
```
|
||||
helm plugin update <plugin>...
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
--debug enable verbose output
|
||||
--home string location of your Helm config. Overrides $HELM_HOME (default "~/.helm")
|
||||
--host string address of tiller. Overrides $HELM_HOST
|
||||
--kube-context string name of the kubeconfig context to use
|
||||
--tiller-namespace string namespace of tiller (default "kube-system")
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
* [helm plugin](helm_plugin.md) - add, list, or remove Helm plugins
|
||||
|
||||
###### Auto generated by spf13/cobra on 26-May-2017
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue