@@ -68,7 +68,16 @@ func (k Kustomize) Render(ctx context.Context, out io.Writer, builds []graph.Art
68
68
kCLI := kubectl .NewCLI (k .cfg , "" )
69
69
useKubectlKustomize := ! generate .KustomizeBinaryCheck () && generate .KubectlVersionCheck (kCLI )
70
70
71
- for _ , kustomizePath := range sUtil .AbsolutePaths (k .cfg .GetWorkingDir (), k .rCfg .Kustomize .Paths ) {
71
+ var kustomizePaths []string
72
+ for _ , kustomizePath := range k .rCfg .Kustomize .Paths {
73
+ kPath , err := sUtil .ExpandEnvTemplate (kustomizePath , nil )
74
+ if err != nil {
75
+ return manifest.ManifestListByConfig {}, fmt .Errorf ("unable to parse path %q: %w" , kustomizePath , err )
76
+ }
77
+ kustomizePaths = append (kustomizePaths , kPath )
78
+ }
79
+
80
+ for _ , kustomizePath := range sUtil .AbsolutePaths (k .cfg .GetWorkingDir (), kustomizePaths ) {
72
81
out , err := k .render (ctx , kustomizePath , useKubectlKustomize , kCLI )
73
82
if err != nil {
74
83
return manifest.ManifestListByConfig {}, err
@@ -106,11 +115,6 @@ func (k Kustomize) Render(ctx context.Context, out io.Writer, builds []graph.Art
106
115
107
116
func (k Kustomize ) render (ctx context.Context , kustomizePath string , useKubectlKustomize bool , kCLI * kubectl.CLI ) ([]byte , error ) {
108
117
var out []byte
109
- var err error
110
- kPath , err := sUtil .ExpandEnvTemplate (kustomizePath , nil )
111
- if err != nil {
112
- return out , fmt .Errorf ("unable to parse path %q: %w" , kustomizePath , err )
113
- }
114
118
115
119
if ! k .transformer .IsEmpty () && ! sUtil .IsURL (kustomizePath ) {
116
120
temp , err := os .MkdirTemp ("" , "*" )
@@ -120,17 +124,17 @@ func (k Kustomize) render(ctx context.Context, kustomizePath string, useKubectlK
120
124
fs := newTmpFS (temp )
121
125
defer fs .Cleanup ()
122
126
123
- if err := k .mirror (kPath , fs ); err == nil {
124
- kPath = filepath .Join (temp , kPath )
127
+ if err := k .mirror (kustomizePath , fs ); err == nil {
128
+ kustomizePath = filepath .Join (temp , kustomizePath )
125
129
} else {
126
130
return out , err
127
131
}
128
132
}
129
133
130
134
if useKubectlKustomize {
131
- return kCLI .Kustomize (ctx , kustomizeBuildArgs (k .rCfg .Kustomize .BuildArgs , kPath ))
135
+ return kCLI .Kustomize (ctx , kustomizeBuildArgs (k .rCfg .Kustomize .BuildArgs , kustomizePath ))
132
136
} else {
133
- cmd := exec .CommandContext (ctx , "kustomize" , append ([]string {"build" }, kustomizeBuildArgs (k .rCfg .Kustomize .BuildArgs , kPath )... )... )
137
+ cmd := exec .CommandContext (ctx , "kustomize" , append ([]string {"build" }, kustomizeBuildArgs (k .rCfg .Kustomize .BuildArgs , kustomizePath )... )... )
134
138
return sUtil .RunCmdOut (ctx , cmd )
135
139
}
136
140
}
0 commit comments