Skip to content

Commit

Permalink
fix(helm): Check prior vendoring of helm charts
Browse files Browse the repository at this point in the history
  • Loading branch information
justinwalz committed Oct 23, 2020
1 parent a18afbf commit a8a9594
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion pkg/helm/charts.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ func (c Charts) Vendor() error {

log.Println("Pulling Charts ...")
for _, r := range c.Manifest.Requires {
chartName := parseReqName(r.Chart)
chartPath := filepath.Join(dir, chartName)
if _, err := os.Stat(chartPath); err == nil {
log.Printf(" %s@%s exists", r.Chart, r.Version.String())
continue
}

err := c.Helm.Pull(r.Chart, r.Version.String(), PullOpts{
Destination: dir,
Opts: Opts{Repositories: c.Manifest.Repositories},
Expand All @@ -101,7 +108,7 @@ func (c Charts) Vendor() error {
return err
}

log.Printf(" %s@%s", r.Chart, r.Version.String())
log.Printf(" %s@%s downloaded", r.Chart, r.Version.String())
}

return nil
Expand Down Expand Up @@ -199,3 +206,10 @@ func parseReq(s string) (*Requirement, error) {
Version: *ver,
}, nil
}

// parseReqName parses a name from a string of the format `repo/name`
func parseReqName(s string) string {
elems := strings.Split(s, "/")
name := elems[1]
return name
}

0 comments on commit a8a9594

Please sign in to comment.