pull/1121/merge
Joe Farrell 9 years ago committed by GitHub
commit 7bc6ba9dbf

@ -28,6 +28,8 @@ import (
"k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/helm"
"k8s.io/helm/pkg/lint"
"k8s.io/helm/pkg/lint/support"
"k8s.io/helm/pkg/provenance"
"k8s.io/helm/pkg/repo"
)
@ -46,6 +48,7 @@ Versioned chart archives are used by Helm package repositories.
type packageCmd struct {
save bool
sign bool
nolint bool
path string
key string
keyring string
@ -87,6 +90,7 @@ func newPackageCmd(client helm.Interface, out io.Writer) *cobra.Command {
f.BoolVar(&pkg.sign, "sign", false, "use a PGP private key to sign this package")
f.StringVar(&pkg.key, "key", "", "the name of the key to use when signing. Used if --sign is true.")
f.StringVar(&pkg.keyring, "keyring", defaultKeyring(), "the location of a public keyring")
f.BoolVar(&pkg.nolint, "no-lint", false, "not lint a chart before packaging it")
return cmd
}
@ -97,6 +101,18 @@ func (p *packageCmd) run(cmd *cobra.Command, args []string) error {
return err
}
if p.nolint != true {
linter := lint.All(path)
if linter.HighestSeverity == support.ErrorSev {
for _, msg := range linter.Messages {
if msg.Severity == support.ErrorSev {
cmd.Println(msg)
}
}
return fmt.Errorf("chart lint failed")
}
}
ch, err := chartutil.LoadDir(path)
if err != nil {
return err

@ -63,6 +63,13 @@ func TestPackage(t *testing.T) {
expect: "",
hasfile: "alpine-0.1.0.tgz",
},
{
name: "package testdata/testcharts/alpine --no-lint",
args: []string{"testdata/testcharts/alpine"},
flags: map[string]string{"nolint": "1"},
expect: "",
hasfile: "alpine-0.1.0.tgz",
},
{
name: "package --sign --key=KEY --keyring=KEYRING testdata/testcharts/alpine",
args: []string{"testdata/testcharts/alpine"},

Loading…
Cancel
Save