Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conftest fails on YAMLs with version #998

Open
pstoeckle opened this issue Sep 3, 2024 · 2 comments
Open

Conftest fails on YAMLs with version #998

pstoeckle opened this issue Sep 3, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@pstoeckle
Copy link

I wanted to check a YAML document with the YAML version in the preamble

%YAML 1.1
---
group_id: 1234

... using ...

conftest test --parser yaml test.yml

However, conftest fails stating

Error: running test: parse configurations: parser unmarshal: unmarshal multiple documents: unmarshal subdocument yaml: error converting YAML to JSON: yaml: line 1: did not find expected <document start>, path: test.yml

If I remove the preamble, it works.

@jalseth jalseth added the bug Something isn't working label Sep 4, 2024
@jalseth
Copy link
Member

jalseth commented Sep 4, 2024

This is new to me, but a quick skim of the YAML 1.2 spec indicates this should be supported. Conftest is using sigs.k8s.io/yaml for its YAML parsing. Do you happen to know of any Golang YAML parsers that support this?

@pstoeckle
Copy link
Author

Do you happen to know of any Golang YAML parsers that support this?

No, not really.

My fix was so far to simply remove the preamble ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants