Skip to content

Commit 46a61e1

Browse files
authored
make listFiles result alphabetically sorted (#282)
1 parent 2e47560 commit 46a61e1

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pkg/manifests/kustomize/generator.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,12 @@ func NewKustomizeGenerator(fsys fs.FS, kustomizationPath string, _ client.Client
131131
if err != nil {
132132
return nil, err
133133
}
134-
// Note: we use relative paths as templates names to make it easier to copy the kustomization
135-
// content into the ephemeral in-memory filesystem used by krusty in Generate()
136134
name, err := filepath.Rel(kustomizationPath, file)
137-
g.files[name] = raw
138135
if err != nil {
139136
// TODO: is it ok to panic here in case of error ?
140137
panic("this cannot happen")
141138
}
139+
g.files[name] = raw
142140
if filepath.Base(name) != componentConfigFilename && strings.HasSuffix(name, *options.TemplateSuffix) {
143141
if t == nil {
144142
t = template.New(name)
@@ -320,7 +318,7 @@ func makeFuncListFiles(files map[string][]byte) func(pattern string) ([]string,
320318
if err != nil {
321319
return nil, err
322320
}
323-
return slices.Select(maps.Keys(files), func(path string) bool { return g.Match(path) }), nil
321+
return slices.Sort(slices.Select(maps.Keys(files), func(path string) bool { return g.Match(path) })), nil
324322
}
325323
}
326324

0 commit comments

Comments
 (0)