@@ -3,19 +3,14 @@ package actions
33import (
44 "bytes"
55 "fmt"
6- "path/filepath"
7- "regexp"
86 "strings"
97
108 "helm.sh/helm/v3/pkg/action"
119 "helm.sh/helm/v3/pkg/chart/loader"
1210 "helm.sh/helm/v3/pkg/cli"
13- "helm.sh/helm/v3/pkg/releaseutil"
1411)
1512
1613func RenderManifests (name string , url string , vals map [string ]interface {}, conf * action.Configuration ) (string , error ) {
17- var showFiles []string
18- response := make (map [string ]string )
1914 validate := false
2015 client := action .NewInstall (conf )
2116 client .DryRun = true
@@ -70,42 +65,6 @@ func RenderManifests(name string, url string, vals map[string]interface{}, conf
7065 }
7166 }
7267
73- // if we have a list of files to render, then check that each of the
74- // provided files exists in the chart.
75- if len (showFiles ) > 0 {
76- splitManifests := releaseutil .SplitManifests (manifests .String ())
77- manifestNameRegex := regexp .MustCompile ("# Source: [^/]+/(.+)" )
78- var manifestsToRender []string
79- for _ , f := range showFiles {
80- missing := true
81- for _ , manifest := range splitManifests {
82- submatch := manifestNameRegex .FindStringSubmatch (manifest )
83- if len (submatch ) == 0 {
84- continue
85- }
86- manifestName := submatch [1 ]
87- // manifest.Name is rendered using linux-style filepath separators on Windows as
88- // well as macOS/linux.
89- manifestPathSplit := strings .Split (manifestName , "/" )
90- manifestPath := filepath .Join (manifestPathSplit ... )
91-
92- // if the filepath provided matches a manifest path in the
93- // chart, render that manifest
94- if f == manifestPath {
95- manifestsToRender = append (manifestsToRender , manifest )
96- missing = false
97- }
98- }
99- if missing {
100- return "" , fmt .Errorf ("could not find template %s in chart" , f )
101- }
102- for _ , m := range manifestsToRender {
103- response [f ] = m
104- fmt .Fprintf (& output , "---\n %s\n " , m )
105- }
106- }
107- } else {
108- fmt .Fprintf (& output , "%s" , manifests .String ())
109- }
68+ fmt .Fprintf (& output , "%s" , manifests .String ())
11069 return output .String (), nil
11170}
0 commit comments