Skip to content

Commit

Permalink
Merge pull request #2839 from mattwelke/feat/better-err-msg-adding-ch…
Browse files Browse the repository at this point in the history
…art-during-init

fix: better error message for invalid Helm Chart path during init
  • Loading branch information
lizardruss authored May 14, 2024
2 parents f29e897 + 84cbb8b commit 4a9f4fe
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions pkg/devspace/configure/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,28 @@ func (m *manager) AddHelmDeployment(deploymentName string) error {
localChartPathRel = localChartPath
}

stat, err := os.Stat(path.Join(localChartPathRel, "Chart.yaml"))
if err != nil || stat.IsDir() {
pathStat, err := os.Stat(localChartPathRel)
if err != nil {
return err
}

if !pathStat.IsDir() {
m.log.WriteString(logrus.InfoLevel, "\n")
m.log.Errorf("Local path `%s` is not a Helm chart (Chart.yaml missing)", localChartPathRel)
m.log.Errorf("Local path `%s` is not a Helm chart (path is not a directory)", localChartPathRel)
continue
}

if _, err := os.Stat(path.Join(localChartPathRel, "Chart.yaml")); err != nil {
m.log.WriteString(logrus.InfoLevel, "\n")
if errors.Is(err, os.ErrNotExist) {
m.log.Errorf("Local path `%s` is not a Helm chart (Chart.yaml missing)", localChartPathRel)
continue
} else {
m.log.Errorf("Encountered unexpected error checking local path `%s`: %s", localChartPathRel, err.Error())
continue
}
}

helmConfig.Chart.Name = localChartPathRel
m.isRemote[deploymentName] = false
} else if chartLocation == chartRepo || chartLocation == archiveURL {
Expand Down

0 comments on commit 4a9f4fe

Please sign in to comment.