Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/chart_template_guide/accessing_files.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,9 @@ data:
{{ . }}{{ end }}
```

If the file is empty or does not exist, `Lines` returns an empty list. In that
case, a `range` over it simply produces no output instead of failing.
If the file you reference is empty or does not exist, `Lines` returns an empty

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied the same Lines note to the current (v4) docs because PR #32303 is the v3 backport of #32290, which lands the identical pkg/engine/files.go fix on main, so the empty-file behavior holds for v4 as well.

Source: helm/helm#32290

list rather than failing. The `range` loop then produces no output, so
referencing a missing or empty file will not cause template rendering to fail.

There is no way to pass files external to the chart during `helm install`. So if
you are asking users to supply data, it must be loaded using `helm install -f`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ data:
{{ . }}{{ end }}
```

If the file you reference is empty or does not exist, `Lines` returns an empty

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the empty/missing-file note because this PR changes files.Lines in pkg/engine/files.go — the guard becomes len(f[path]) == 0 so empty files return an empty []string{} like missing files already did, instead of panicking with index-out-of-range and failing the render.

Source: helm/helm#32303

list rather than failing. The `range` loop then produces no output, so
referencing a missing or empty file will not cause template rendering to fail.

There is no way to pass files external to the chart during `helm install`. So if
you are asking users to supply data, it must be loaded using `helm install -f`
or `helm install --set`.
Expand Down
Loading