@ -19,6 +19,7 @@ package chartutil
import (
import (
"archive/tar"
"archive/tar"
"compress/gzip"
"compress/gzip"
"encoding/json"
"fmt"
"fmt"
"os"
"os"
"path/filepath"
"path/filepath"
@ -56,6 +57,14 @@ func SaveDir(c *chart.Chart, dest string) error {
}
}
}
}
// Save values.schema.json if it exists
if c . Schema != nil {
filename := filepath . Join ( outdir , SchemafileName )
if err := writeFile ( filename , c . Schema ) ; err != nil {
return err
}
}
// Save templates and files
// Save templates and files
for _ , o := range [ ] [ ] * chart . File { c . Templates , c . Files } {
for _ , o := range [ ] [ ] * chart . File { c . Templates , c . Files } {
for _ , f := range o {
for _ , f := range o {
@ -149,6 +158,16 @@ func writeTarContents(out *tar.Writer, c *chart.Chart, prefix string) error {
return err
return err
}
}
// Save values.schema.json if it exists
if c . Schema != nil {
if ! json . Valid ( c . Schema ) {
return errors . New ( "Invalid JSON in " + SchemafileName )
}
if err := writeToTar ( out , filepath . Join ( base , SchemafileName ) , c . Schema ) ; err != nil {
return err
}
}
// Save templates
// Save templates
for _ , f := range c . Templates {
for _ , f := range c . Templates {
n := filepath . Join ( base , f . Name )
n := filepath . Join ( base , f . Name )