carvel-dev / vendir

Easy way to vendor portions of git repos, github releases, helm charts, docker image contents, etc. declaratively
https://carvel.dev/vendir
Apache License 2.0
276 stars 49 forks source link

Error parsing empty yaml documents #201

Closed Zebradil closed 1 year ago

Zebradil commented 1 year ago

This works as expected (I do not provide a proper config to vendir, so the error is legit):

/tmp/tmp.6TXoJB3vud
❯ cat <<EOF | vendir sync -f-
---
apiVersion: v1
kind: Secret
metadata:
  name: vendir-secret
data:
  username: dXNlcg==
  password: MTIzNDU2
EOF
vendir: Error: Expected to find at least one config, but found none

This doesn't work as expected:

/tmp/tmp.6TXoJB3vud
❮ cat <<EOF | vendir sync -f-

---
apiVersion: v1
kind: Secret
metadata:
  name: vendir-secret
data:
  username: dXNlcg==
  password: MTIzNDU2
EOF
vendir: Error: Parsing resource config '-':
  Unknown apiVersion '' or kind '' for resource

Notice the blank line at the beginning of the second example. Having a blank line followed by the yaml document marker --- seems to be recognized by vendir as a yaml document. I would expect that such empty documents are just ignored.

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.

cppforlife commented 1 year ago

im guessing go library is interpreting is as either null or {} for that first document. should be reasonable to ignore it. (PRs welcome)