Skip to content

Commit

Permalink
fix: append additional files correctly for sub charts (#2216)
Browse files Browse the repository at this point in the history
  • Loading branch information
morningvera committed Sep 25, 2021
1 parent 7156a60 commit e20e23c
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions pkg/base/helm.go
Expand Up @@ -235,13 +235,26 @@ func removeCommonPrefix(baseFiles []BaseFile) []BaseFile {

func helmChartBaseAppendAdditionalFiles(base Base, u *upstreamtypes.Upstream) Base {
for _, upstreamFile := range u.Files {
if upstreamFile.Path == path.Join(base.Path, "Chart.yaml") {
// need to check if base path is an empty string here to catch just the top level additional files
// otherwise, we need to check if the upstream path contains the base path to correctly add files for sub-charts
if base.Path == "" && upstreamFile.Path == path.Join(base.Path, "Chart.yaml") {
base.AdditionalFiles = append(base.AdditionalFiles, BaseFile{
Path: "Chart.yaml",
Content: upstreamFile.Content,
})
} else if base.Path != "" && strings.Contains(upstreamFile.Path, path.Join(base.Path, "Chart.yaml")) {
base.AdditionalFiles = append(base.AdditionalFiles, BaseFile{
Path: "Chart.yaml",
Content: upstreamFile.Content,
})
}
if upstreamFile.Path == path.Join(base.Path, "Chart.lock") {

if base.Path == "" && upstreamFile.Path == path.Join(base.Path, "Chart.lock") {
base.AdditionalFiles = append(base.AdditionalFiles, BaseFile{
Path: "Chart.lock",
Content: upstreamFile.Content,
})
} else if base.Path != "" && strings.Contains(upstreamFile.Path, path.Join(base.Path, "Chart.lock")) {
base.AdditionalFiles = append(base.AdditionalFiles, BaseFile{
Path: "Chart.lock",
Content: upstreamFile.Content,
Expand Down

0 comments on commit e20e23c

Please sign in to comment.