Merge branch 'master' of https://github.com/kubernetes/helm into simplify_slice

pull/4963/head
tariqibrahim 7 years ago
commit c89bc33b92

@ -6,10 +6,10 @@ environment:
install: install:
- ps: iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/fishworks/gofish/master/scripts/install.ps1')) - ps: iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/fishworks/gofish/master/scripts/install.ps1'))
- gofish init - gofish init
- gofish install dep - gofish install glide
- dep ensure -v - glide install --strip-vendor
cache: cache:
- vendor -> Gopkg.lock - vendor -> glide.lock
build: "off" build: "off"
deploy: "off" deploy: "off"
test_script: test_script:

@ -178,7 +178,7 @@ contributing to Helm. All issue types follow the same general lifecycle. Differe
1. Submit a pull request. 1. Submit a pull request.
Coding conventions and standards are explained in the official developer docs: Coding conventions and standards are explained in the official developer docs:
https://github.com/helm/helm/blob/master/docs/developers.md [Developers Guide](docs/developers.md)
The next section contains more information on the workflow followed for PRs The next section contains more information on the workflow followed for PRs

@ -75,6 +75,9 @@ func newCreateCmd(out io.Writer) *cobra.Command {
if len(args) == 0 { if len(args) == 0 {
return errors.New("the name of the new chart is required") return errors.New("the name of the new chart is required")
} }
if len(args) > 1 {
return errors.New("command 'create' doesn't support multiple arguments")
}
cc.name = args[0] cc.name = args[0]
return cc.run() return cc.run()
}, },

@ -29,6 +29,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"k8s.io/client-go/util/homedir"
"k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/helm"
"k8s.io/helm/pkg/helm/environment" "k8s.io/helm/pkg/helm/environment"
"k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/helm/helmpath"
@ -167,7 +168,7 @@ func TestRootCmd(t *testing.T) {
{ {
name: "defaults", name: "defaults",
args: []string{"home"}, args: []string{"home"},
home: filepath.Join(os.Getenv("HOME"), "/.helm"), home: filepath.Join(homedir.HomeDir(), ".helm"),
}, },
{ {
name: "with --home set", name: "with --home set",
@ -236,7 +237,7 @@ func TestTLSFlags(t *testing.T) {
homePath := os.Getenv("HELM_HOME") homePath := os.Getenv("HELM_HOME")
if homePath == "" { if homePath == "" {
homePath = filepath.Join(os.Getenv("HOME"), ".helm") homePath = filepath.Join(homedir.HomeDir(), ".helm")
} }
home := helmpath.Home(homePath) home := helmpath.Home(homePath)

@ -17,10 +17,12 @@ package main
import ( import (
"bytes" "bytes"
"fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"regexp" "regexp"
"runtime"
"testing" "testing"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -53,6 +55,13 @@ func TestSetVersion(t *testing.T) {
func TestPackage(t *testing.T) { func TestPackage(t *testing.T) {
statExe := "stat"
statFileMsg := "no such file or directory"
if runtime.GOOS == "windows" {
statExe = "FindFirstFile"
statFileMsg = "The system cannot find the file specified."
}
tests := []struct { tests := []struct {
name string name string
flags map[string]string flags map[string]string
@ -106,7 +115,7 @@ func TestPackage(t *testing.T) {
name: "package --destination does-not-exist", name: "package --destination does-not-exist",
args: []string{"testdata/testcharts/alpine"}, args: []string{"testdata/testcharts/alpine"},
flags: map[string]string{"destination": "does-not-exist"}, flags: map[string]string{"destination": "does-not-exist"},
expect: "stat does-not-exist: no such file or directory", expect: fmt.Sprintf("Failed to save: %s does-not-exist: %s", statExe, statFileMsg),
err: true, err: true,
}, },
{ {

@ -75,7 +75,7 @@ func TestTemplateCmd(t *testing.T) {
{ {
name: "check_execute_absolute", name: "check_execute_absolute",
desc: "verify --execute single template", desc: "verify --execute single template",
args: []string{subchart1ChartPath, "-x", subchart1AbsChartPath + "/" + "templates/service.yaml", "--set", "service.name=apache"}, args: []string{subchart1ChartPath, "-x", filepath.Join(subchart1AbsChartPath, "templates", "service.yaml"), "--set", "service.name=apache"},
expectKey: "subchart1/templates/service.yaml", expectKey: "subchart1/templates/service.yaml",
expectValue: "protocol: TCP\n name: apache", expectValue: "protocol: TCP\n name: apache",
}, },

@ -28,7 +28,7 @@ func TestVerifyCmd(t *testing.T) {
statPathMsg := "no such file or directory" statPathMsg := "no such file or directory"
statFileMsg := statPathMsg statFileMsg := statPathMsg
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
statExe = "GetFileAttributesEx" statExe = "FindFirstFile"
statPathMsg = "The system cannot find the path specified." statPathMsg = "The system cannot find the path specified."
statFileMsg = "The system cannot find the file specified." statFileMsg = "The system cannot find the file specified."
} }

@ -24,6 +24,7 @@
- [Variables](chart_template_guide/variables.md) - [Variables](chart_template_guide/variables.md)
- [Named Templates (Partials)](chart_template_guide/named_templates.md) - [Named Templates (Partials)](chart_template_guide/named_templates.md)
- [Accessing Files Inside Templates](chart_template_guide/accessing_files.md) - [Accessing Files Inside Templates](chart_template_guide/accessing_files.md)
- [Ignoring unwanted files and folders](chart_template_guide/helm_ignore_file.md)
- [Creating a NOTES.txt File](chart_template_guide/notes_files.md) - [Creating a NOTES.txt File](chart_template_guide/notes_files.md)
- [Subcharts and Global Values](chart_template_guide/subcharts_and_globals.md) - [Subcharts and Global Values](chart_template_guide/subcharts_and_globals.md)
- [Debugging Templates](chart_template_guide/debugging.md) - [Debugging Templates](chart_template_guide/debugging.md)

@ -0,0 +1,23 @@
# The .helmignore file
The `.helmignore` file is used to specify files you don't want to include in your helm chart.
If this file exists, the `helm package` command will ignore all the files that match the pattern specified in the `.helmignore` file while packaging your application.
This can help in avoiding unncessary or sensitive files or directories from being added in your helm chart.
The `.helmignore` file supports Unix shell glob matching, relative path matching, and negation (prefixed with !). Only one pattern per line is considered.
Here is an example `.helmignore` file:
```
# comment
.git
*/temp*
*/*/temp*
temp?
```
**We'd love your help** making this document better. To add, correct, or remove
information, [file an issue](https://github.com/helm/helm/issues) or
send us a pull request.

@ -124,7 +124,14 @@ project is:
## Chart LICENSE, README and NOTES ## Chart LICENSE, README and NOTES
Charts can also contain files that describe the installation, configuration, usage and license of a Charts can also contain files that describe the installation, configuration, usage and license of a
chart. A README for a chart should be formatted in Markdown (README.md), and should generally chart.
A LICENSE is a plain text file containing the [license](https://en.wikipedia.org/wiki/Software_license)
for the chart. The chart can contain a license as it may have programming logic in the templates and
would therefore not be configuration only. There can also be separate license(s) for the application
installed by the chart, if required.
A README for a chart should be formatted in Markdown (README.md), and should generally
contain: contain:
- A description of the application or service the chart provides - A description of the application or service the chart provides
@ -259,27 +266,27 @@ Tags - The tags field is a YAML list of labels to associate with this chart.
In the top parent's values, all charts with tags can be enabled or disabled by In the top parent's values, all charts with tags can be enabled or disabled by
specifying the tag and a boolean value. specifying the tag and a boolean value.
```` ```yaml
# parentchart/requirements.yaml # parentchart/requirements.yaml
dependencies: dependencies:
- name: subchart1 - name: subchart1
repository: http://localhost:10191 repository: http://localhost:10191
version: 0.1.0 version: 0.1.0
condition: subchart1.enabled,global.subchart1.enabled condition: subchart1.enabled,global.subchart1.enabled
tags: tags:
- front-end - front-end
- subchart1 - subchart1
- name: subchart2 - name: subchart2
repository: http://localhost:10191 repository: http://localhost:10191
version: 0.1.0 version: 0.1.0
condition: subchart2.enabled,global.subchart2.enabled condition: subchart2.enabled,global.subchart2.enabled
tags: tags:
- back-end - back-end
- subchart2 - subchart2
```` ```
```` ```yaml
# parentchart/values.yaml # parentchart/values.yaml
subchart1: subchart1:

@ -43,6 +43,7 @@ import (
// If a .helmignore file is present, the directory loader will skip loading any files // If a .helmignore file is present, the directory loader will skip loading any files
// matching it. But .helmignore is not evaluated when reading out of an archive. // matching it. But .helmignore is not evaluated when reading out of an archive.
func Load(name string) (*chart.Chart, error) { func Load(name string) (*chart.Chart, error) {
name = filepath.FromSlash(name)
fi, err := os.Stat(name) fi, err := os.Stat(name)
if err != nil { if err != nil {
return nil, err return nil, err

@ -15,6 +15,8 @@ limitations under the License.
package chartutil package chartutil
import ( import (
"os"
"path/filepath"
"sort" "sort"
"testing" "testing"
@ -426,7 +428,12 @@ func TestDependentChartWithSubChartsHelmignore(t *testing.T) {
} }
func TestDependentChartsWithSubChartsSymlink(t *testing.T) { func TestDependentChartsWithSubChartsSymlink(t *testing.T) {
c, err := Load("testdata/joonix") joonix := "testdata/joonix"
if err := os.Symlink(filepath.Join("..", "..", "frobnitz"), filepath.Join(joonix, "charts", "frobnitz")); err != nil {
t.Fatal(err)
}
defer os.RemoveAll(filepath.Join(joonix, "charts", "frobnitz"))
c, err := Load(joonix)
if err != nil { if err != nil {
t.Fatalf("Failed to load testdata: %s", err) t.Fatalf("Failed to load testdata: %s", err)
} }

@ -18,6 +18,7 @@ package getter
import ( import (
"os" "os"
"path/filepath" "path/filepath"
"runtime"
"strings" "strings"
"testing" "testing"
@ -67,6 +68,10 @@ func TestCollectPlugins(t *testing.T) {
} }
func TestPluginGetter(t *testing.T) { func TestPluginGetter(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("TODO: refactor this test to work on windows")
}
oldhh := os.Getenv("HELM_HOME") oldhh := os.Getenv("HELM_HOME")
defer os.Setenv("HELM_HOME", oldhh) defer os.Setenv("HELM_HOME", oldhh)
os.Setenv("HELM_HOME", "") os.Setenv("HELM_HOME", "")

@ -22,6 +22,7 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"path"
"path/filepath" "path/filepath"
"sort" "sort"
"strings" "strings"
@ -110,7 +111,7 @@ func (i IndexFile) Add(md *chart.Metadata, filename, baseURL, digest string) {
_, file := filepath.Split(filename) _, file := filepath.Split(filename)
u, err = urlutil.URLJoin(baseURL, file) u, err = urlutil.URLJoin(baseURL, file)
if err != nil { if err != nil {
u = filepath.Join(baseURL, file) u = path.Join(baseURL, file)
} }
} }
cr := &ChartVersion{ cr := &ChartVersion{
@ -246,9 +247,11 @@ func IndexDirectory(dir, baseURL string) (*IndexFile, error) {
var parentDir string var parentDir string
parentDir, fname = filepath.Split(fname) parentDir, fname = filepath.Split(fname)
// filepath.Split appends an extra slash to the end of parentDir. We want to strip that out.
parentDir = strings.TrimSuffix(parentDir, string(os.PathSeparator))
parentURL, err := urlutil.URLJoin(baseURL, parentDir) parentURL, err := urlutil.URLJoin(baseURL, parentDir)
if err != nil { if err != nil {
parentURL = filepath.Join(baseURL, parentDir) parentURL = path.Join(baseURL, parentDir)
} }
c, err := chartutil.Load(arch) c, err := chartutil.Load(arch)

@ -272,7 +272,7 @@ func verifyLocalIndex(t *testing.T, i *IndexFile) {
} }
func TestIndexDirectory(t *testing.T) { func TestIndexDirectory(t *testing.T) {
dir := "testdata/repository" dir := filepath.Join("testdata", "repository")
index, err := IndexDirectory(dir, "http://localhost:8080") index, err := IndexDirectory(dir, "http://localhost:8080")
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)

Loading…
Cancel
Save