ytt icon indicating copy to clipboard operation
ytt copied to clipboard

Add start of document "---" in the beginning of outputed YAML document

Open damienleger opened this issue 3 years ago • 4 comments

Describe the problem/challenge you have YAML output produced by YTT don't include the start of document --- in the beginning (first document).

Assuming I generate file-1.yml and file-2.yml with YTT, I'm used to do things like cat file-1.yml file-2.yml | kubectl apply -f - but since file-2.yml doesn't start with --- it doesn't work.

Describe the solution you'd like Either add a flag to YTT to include --- on beginning of every document (even the first one), or make this behavior default.

Anything else you would like to add: No


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.

damienleger avatar Aug 19 '21 09:08 damienleger

@damienleger i think this is a reasonable change we can make. just have to decide whether we should do it by default. i think we've done something similar for other carvel tools like kbld.

cppforlife avatar Aug 20 '21 22:08 cppforlife

Any tooling downstream from ytt ought to accept the optional document start (i.e. ---) without problem. 👍🏻

I think this should be the default behavior and have the option to disable it should it either break something (e.g. a highly-precise test), or if there's some interaction with a future feature (e.g. if we ever decide to output comments).

pivotaljohn avatar Aug 24 '21 16:08 pivotaljohn

Rationale for priority: This looks valuable. It's something that we'd definitely support a contribution on. It's not something the core maintainers are committing to do, right now.

pivotaljohn avatar Aug 24 '21 16:08 pivotaljohn

Discussion from duplicate issue:

And to be clear, we're talking about non-empty documents, yeah?

I ask because I know of a few cases where we rely on skipping empty documents to keep the output sane.

We should not add --- on empty documents.

cari-lynn avatar Nov 11 '21 20:11 cari-lynn