mirror of
https://github.com/helm/helm.git
synced 2026-05-28 04:35:48 -04:00
fix(helm): fix repo package to use chartutil
This commit is contained in:
parent
377a43385e
commit
5a2174231b
5 changed files with 12 additions and 9 deletions
|
|
@ -7,7 +7,7 @@ import (
|
|||
|
||||
"gopkg.in/yaml.v2"
|
||||
|
||||
"k8s.io/helm/pkg/chart"
|
||||
"k8s.io/helm/pkg/proto/hapi/chart"
|
||||
)
|
||||
|
||||
var indexPath = "index.yaml"
|
||||
|
|
@ -24,7 +24,7 @@ type ChartRef struct {
|
|||
Created string `yaml:"created,omitempty"`
|
||||
Removed bool `yaml:"removed,omitempty"`
|
||||
Checksum string `yaml:"checksum,omitempty"`
|
||||
Chartfile chart.Chartfile `yaml:"chartfile"`
|
||||
Chartfile *chart.Metadata `yaml:"chartfile"`
|
||||
}
|
||||
|
||||
// DownloadIndexFile uses
|
||||
|
|
|
|||
|
|
@ -29,7 +29,12 @@ func TestDownloadIndexFile(t *testing.T) {
|
|||
fmt.Fprintln(w, string(fileBytes))
|
||||
}))
|
||||
|
||||
dirName, err := ioutil.TempDir("testdata", "tmp")
|
||||
dirName, err := ioutil.TempDir("", "tmp")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer os.RemoveAll(dirName)
|
||||
|
||||
path := filepath.Join(dirName, testRepo+"-index.yaml")
|
||||
if err := DownloadIndexFile(testRepo, ts.URL, path); err != nil {
|
||||
t.Errorf("%#v", err)
|
||||
|
|
@ -54,8 +59,6 @@ func TestDownloadIndexFile(t *testing.T) {
|
|||
t.Errorf("Expected 2 entries in index file but got %v", numEntries)
|
||||
}
|
||||
os.Remove(path)
|
||||
os.Remove(dirName)
|
||||
|
||||
}
|
||||
|
||||
func TestLoadIndexFile(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
"gopkg.in/yaml.v2"
|
||||
|
||||
"k8s.io/helm/pkg/chart"
|
||||
"k8s.io/helm/pkg/chartutil"
|
||||
)
|
||||
|
||||
// ChartRepository represents a chart repository
|
||||
|
|
@ -108,12 +108,12 @@ func (r *ChartRepository) Index() error {
|
|||
}
|
||||
|
||||
for _, path := range r.ChartPaths {
|
||||
ch, err := chart.Load(path)
|
||||
ch, err := chartutil.Load(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
chartfile := ch.Chartfile()
|
||||
chartfile := ch.Metadata
|
||||
hash, err := generateChecksum(path)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -135,7 +135,7 @@ func (r *ChartRepository) Index() error {
|
|||
url, _ := url.Parse(r.URL)
|
||||
url.Path = filepath.Join(url.Path, key+".tgz")
|
||||
|
||||
entry := &ChartRef{Chartfile: *chartfile, Name: chartfile.Name, URL: url.String(), Created: created, Checksum: hash, Removed: false}
|
||||
entry := &ChartRef{Chartfile: chartfile, Name: chartfile.Name, URL: url.String(), Created: created, Checksum: hash, Removed: false}
|
||||
|
||||
r.IndexFile.Entries[key] = entry
|
||||
|
||||
|
|
|
|||
BIN
pkg/repo/testdata/repository/frobnitz-1.2.3.tgz
vendored
BIN
pkg/repo/testdata/repository/frobnitz-1.2.3.tgz
vendored
Binary file not shown.
BIN
pkg/repo/testdata/repository/sprocket-1.2.0.tgz
vendored
BIN
pkg/repo/testdata/repository/sprocket-1.2.0.tgz
vendored
Binary file not shown.
Loading…
Reference in a new issue