Skip to content

Commit

Permalink
do not fail if requirements.yaml does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
pepov committed Sep 11, 2020
1 parent 576611e commit ce61914
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pkg/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import (
"k8s.io/apimachinery/pkg/runtime"
)

const legacyRequirementsFileName = "requirements.yaml"

type ReleaseOptions chartutil.ReleaseOptions

func GetDefaultValues(fs http.FileSystem) ([]byte, error) {
Expand Down Expand Up @@ -132,7 +134,7 @@ func getFiles(fs http.FileSystem) ([]*loader.BufferedFile, error) {
{
// Without requirements.yaml legacy charts's subdependencies will be processed but cannot be disabled
// See https://github.com/helm/helm/blob/e2442699fa4703456b16884990c5218c16ed16fc/pkg/chart/loader/load.go#L105
Name: "requirements.yaml",
Name: legacyRequirementsFileName,
},
}

Expand All @@ -144,24 +146,29 @@ func getFiles(fs http.FileSystem) ([]*loader.BufferedFile, error) {
return nil, err
}
} else {
// Recursively get the all files from the dir and it's subfolders
// Recursively get all the files from the dir and it's subfolders
files, err = getFilesFromDir(fs, dir, files, dirName)
if err != nil {
return nil, err
}
}
}

filteredFiles := []*loader.BufferedFile{}
for _, f := range files {
data, err := readIntoBytes(fs, f.Name)
if err != nil {
if strings.HasSuffix(f.Name, legacyRequirementsFileName) {
continue
}
return nil, err
}

f.Data = data
filteredFiles = append(filteredFiles, f)
}

return files, nil
return filteredFiles, nil
}

func getFilesFromDir(fs http.FileSystem, dir http.File, files []*loader.BufferedFile, dirName string) ([]*loader.BufferedFile, error) {
Expand Down

0 comments on commit ce61914

Please sign in to comment.