diff --git a/pkg/repo/index.go b/pkg/repo/index.go index 6e2c1920d..f61ba57c6 100644 --- a/pkg/repo/index.go +++ b/pkg/repo/index.go @@ -23,7 +23,7 @@ type ChartRef struct { URL string `yaml:"url"` Created string `yaml:"created,omitempty"` Removed bool `yaml:"removed,omitempty"` - Digest string `yaml:"digest,omitempty"` + Checksum string `yaml:"checksum,omitempty"` Chartfile chart.Chartfile `yaml:"chartfile"` } diff --git a/pkg/repo/repo.go b/pkg/repo/repo.go index c8004905d..b5a388020 100644 --- a/pkg/repo/repo.go +++ b/pkg/repo/repo.go @@ -117,7 +117,7 @@ func (r *ChartRepository) Index() error { } chartfile := ch.Chartfile() - hash, err := generateDigest(path) + hash, err := generateChecksum(path) if err != nil { return err } @@ -135,7 +135,9 @@ func (r *ChartRepository) Index() error { created = time.Now().UTC().String() } - entry := &ChartRef{Chartfile: *chartfile, Name: chartfile.Name, URL: r.URL, Created: created, Digest: hash, Removed: false} + url := filepath.Join(r.URL, key+".tgz") + + entry := &ChartRef{Chartfile: *chartfile, Name: chartfile.Name, URL: url, Created: created, Checksum: hash, Removed: false} r.IndexFile.Entries[key] = entry @@ -148,7 +150,7 @@ func (r *ChartRepository) Index() error { return nil } -func generateDigest(path string) (string, error) { +func generateChecksum(path string) (string, error) { f, err := os.Open(path) if err != nil { return "", err diff --git a/pkg/repo/repo_test.go b/pkg/repo/repo_test.go index 3680691c5..7593d67fd 100644 --- a/pkg/repo/repo_test.go +++ b/pkg/repo/repo_test.go @@ -69,8 +69,8 @@ func TestIndex(t *testing.T) { } timestamps[chartName] = details.Created - if details.Digest == "" { - t.Errorf("Digest was not set for %s", chartName) + if details.Checksum == "" { + t.Errorf("Checksum was not set for %s", chartName) } } @@ -90,6 +90,10 @@ func TestIndex(t *testing.T) { if v.Created != created { t.Errorf("Expected Created timestamp to be %s, but got %s for chart %s", created, v.Created, chart) } + expectedURL := filepath.Join(cr.URL, chart+".tgz") + if v.URL != expectedURL { + t.Errorf("Expected url in entry to be %s but got %s for chart: %s", expectedURL, v.URL, chart) + } } }