2

I have config like this:

{{- with .Files.Glob "files/my-files/*.json" }}
{{ .AsConfig | indent 2 }}
{{- end }}

In the end of each file I want to add "FIHISHED!"

How can I achieve it in helm ?

gstackoverflow
  • 36,709
  • 117
  • 359
  • 710

1 Answers1

1

The .AsConfig method renders and returns all files as a single YAML text. So you can't format the result.

If you want to list all files (with content), separated with an arbitrary text, I suggest to do this "yourself". Files is a map of files, mapping from string name to []byte content.

{{- with .Files.Glob "files/my-files/*.json" }}
{{ range $name, $content := . -}}
    {{ printf "-%s:\n%s\nFINISHED!" $name $content | indent 2 }}:
{{- end }}
{{- end }}
icza
  • 389,944
  • 63
  • 907
  • 827