Merge pull request #2481 from sushilkm/issues/2480

Errors out if install/upgrade fails to load-requirements
reviewable/pr2499/r1
Taylor Thomas 8 years ago committed by GitHub
commit 3ed1ccf5dc

@ -232,6 +232,8 @@ func (i *installCmd) run() error {
if err := checkDependencies(chartRequested, req, i.out); err != nil {
return prettyError(err)
}
} else if err != chartutil.ErrRequirementsNotFound {
return fmt.Errorf("cannot load requirements: %v", err)
}
res, err := i.client.InstallReleaseFromChart(

@ -138,6 +138,12 @@ func TestInstall(t *testing.T) {
args: []string{"testdata/testcharts/chart-missing-deps"},
err: true,
},
// Install, chart with bad requirements.yaml in /charts
{
name: "install chart with bad requirements.yaml",
args: []string{"testdata/testcharts/chart-bad-requirements"},
err: true,
},
}
runReleaseCases(t, tests, func(c *fakeReleaseClient, out io.Writer) *cobra.Command {

@ -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

@ -185,7 +185,11 @@ func (u *upgradeCmd) run() error {
if err := checkDependencies(ch, req, u.out); err != nil {
return err
}
} else if err != chartutil.ErrRequirementsNotFound {
return fmt.Errorf("cannot load requirements: %v", err)
}
} else {
return prettyError(err)
}
resp, err := u.client.UpdateRelease(

@ -82,6 +82,7 @@ func TestUpgradeCmd(t *testing.T) {
originalDepsPath := filepath.Join("testdata/testcharts/reqtest")
missingDepsPath := filepath.Join("testdata/testcharts/chart-missing-deps")
badDepsPath := filepath.Join("testdata/testcharts/chart-bad-requirements")
var ch3 *chart.Chart
ch3, err = chartutil.Load(originalDepsPath)
if err != nil {
@ -143,6 +144,12 @@ func TestUpgradeCmd(t *testing.T) {
resp: releaseMock(&releaseOptions{name: "bonkers-bunny", version: 1, chart: ch3}),
err: true,
},
{
name: "upgrade a release with bad dependencies",
args: []string{"bonkers-bunny", badDepsPath},
resp: releaseMock(&releaseOptions{name: "bonkers-bunny", version: 1, chart: ch3}),
err: true,
},
}
cmd := func(c *fakeReleaseClient, out io.Writer) *cobra.Command {

Loading…
Cancel
Save