Skip to content

Commit

Permalink
Tolerate dependency charts without values.yaml
Browse files Browse the repository at this point in the history
When evaluating chart dependencies, log a warning instead of aborting dependency resolution, if a dependency does not exist because it was invalid. This is useful for library charts which may not have values.
  • Loading branch information
armsnyder committed Apr 3, 2022
1 parent 3d463f7 commit cae8f4b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions example-charts/umbrella/Chart.yaml
Expand Up @@ -8,3 +8,5 @@ dependencies:
version: 0.1.0
- name: sub-b
version: 0.1.0
- name: library
version: 0.1.0
5 changes: 5 additions & 0 deletions example-charts/umbrella/charts/library/Chart.yaml
@@ -0,0 +1,5 @@
apiVersion: v2
name: library
description: An example library sub-chart with no values.
version: "0.1.0"
type: library
5 changes: 3 additions & 2 deletions pkg/document/dependency_values.go
Expand Up @@ -2,9 +2,9 @@ package document

import (
"errors"
"fmt"
"path/filepath"

log "github.com/sirupsen/logrus"
"gopkg.in/yaml.v3"

"github.com/norwoodj/helm-docs/pkg/helm"
Expand Down Expand Up @@ -35,7 +35,8 @@ func getDependencyValuesWithPrefix(root helm.ChartDocumentationInfo, allChartInf
searchPath := filepath.Join(root.ChartDirectory, "charts", dep.Name)
depInfo, ok := allChartInfoByChartPath[searchPath]
if !ok {
return nil, fmt.Errorf("dependency with path %q was not found", searchPath)
log.Warnf("Dependency with path %q was not found. Dependency values will not be included.", searchPath)
continue
}

alias := dep.Alias
Expand Down

0 comments on commit cae8f4b

Please sign in to comment.