Skip to content

Commit

Permalink
Warn about remote dependencies without erroring; Parse local file:// …
Browse files Browse the repository at this point in the history
…repositories
  • Loading branch information
armsnyder committed Apr 3, 2022
1 parent 0b4f3ce commit 1785bfb
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 4 deletions.
4 changes: 4 additions & 0 deletions example-charts/umbrella/charts/sub-a/Chart.yaml
Expand Up @@ -3,3 +3,7 @@ name: sub-a
description: A sub-chart.
version: "0.1.0"
type: application
dependencies:
- name: library
version: 0.1.0
repository: file://../library
6 changes: 6 additions & 0 deletions example-charts/umbrella/charts/sub-a/README.md
Expand Up @@ -4,6 +4,12 @@

A sub-chart.

## Requirements

| Repository | Name | Version |
|------------|------|---------|
| file://../library | library | 0.1.0 |

## Values

| Key | Type | Default | Description |
Expand Down
4 changes: 4 additions & 0 deletions example-charts/umbrella/charts/sub-b/Chart.yaml
Expand Up @@ -3,3 +3,7 @@ name: sub-b
description: A sub-chart.
version: "0.1.0"
type: application
dependencies:
- name: library
version: 0.1.0
repository: file://../library
6 changes: 6 additions & 0 deletions example-charts/umbrella/charts/sub-b/README.md
Expand Up @@ -4,6 +4,12 @@

A sub-chart.

## Requirements

| Repository | Name | Version |
|------------|------|---------|
| file://../library | library | 0.1.0 |

## Values

| Key | Type | Default | Description |
Expand Down
14 changes: 10 additions & 4 deletions pkg/document/dependency_values.go
@@ -1,8 +1,8 @@
package document

import (
"errors"
"path/filepath"
"strings"

log "github.com/sirupsen/logrus"
"gopkg.in/yaml.v3"
Expand All @@ -28,11 +28,17 @@ func getDependencyValuesWithPrefix(root helm.ChartDocumentationInfo, allChartInf
result := make([]DependencyValues, 0, len(root.Dependencies))

for _, dep := range root.Dependencies {
if dep.Repository != "" {
return nil, errors.New("remote dependencies are not yet supported")
searchPath := ""

if strings.HasPrefix(dep.Repository, "file://") {
searchPath = filepath.Join(root.ChartDirectory, strings.TrimPrefix(dep.Repository, "file://"))
} else if dep.Repository != "" {
log.Warnf("Chart in %q has a remote dependency %q. Dependency values will not be included.", root.ChartDirectory, dep.Name)
continue
} else {
searchPath = filepath.Join(root.ChartDirectory, "charts", dep.Name)
}

searchPath := filepath.Join(root.ChartDirectory, "charts", dep.Name)
depInfo, ok := allChartInfoByChartPath[searchPath]
if !ok {
log.Warnf("Dependency with path %q was not found. Dependency values will not be included.", searchPath)
Expand Down

0 comments on commit 1785bfb

Please sign in to comment.