carvel-dev / ytt

YAML templating tool that works on YAML structure instead of text
https://carvel.dev/ytt
Apache License 2.0
1.69k stars 137 forks source link

Values file `data.list("/")` should read from root library #645

Closed cari-lynn closed 2 years ago

cari-lynn commented 2 years ago

What steps did you take: When data.list("/") within a data values file, it should list the files relative to the root library. Playground reproduction example: https://carvel.dev/ytt/#gist:https://gist.github.com/cari-lynn/8b7c194fd28bcab0ec80e716eecc161f

What happened: It will list no files at all.

What did you expect: I expect that data.list("/") will list all files relative to the root library

Anything else you would like to add: data.list("") without the / will list files relative to the current directory just as expected. This problem just shows up when using the /.

I believe this happens because we don't pass down the root library during data values pre processing. But I believe this could be changed.

https://github.com/vmware-tanzu/carvel-ytt/blob/develop/pkg/workspace/data_values_pre_processing.go#L119-L121

ytt Docs

originating Slack thread in #carvel

Environment:


Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible" 👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

cari-lynn commented 2 years ago

It's also not possible to read from the root directory in data.read("/") in a data values file only. It is still able to read from the same directory. I believe its caused by the same thing as this bug. Heres my reproduction example.

voor commented 2 years ago

Is there an incoming reason for closing this issue?

pivotaljohn commented 2 years ago

Ah! I thought that this issue was linked with it's PR (it is in ZenHub, but not GitHub).

It's been fixed, sir.

We're looking at cutting the next version soon!