5

I am using https://yamllint.readthedocs.io/en/stable/index.html to lint my yaml files (used in a saltstack context, and linted by jenkins jobs at every commit), but as reported and explained here, it is not possible to validate a yaml file in which is used jinja code.

How do you guys validate / lint your yaml files ?

Do you see a way to keep using yamllint without failing due to jinja code ?

Yaml structure error are the most occuring errors in my company, people from very different background come to edit pillar, that's why I really need a yaml validating process.

4 Answers 4

0

My bad, I was searching using the wrong keyword, I just found out that ignoring a file or dir is quite easy, you just need to add an gitignore style block to your yamllint config file, as :

ignore: |
  *globalParamName.sls
  *platform.sls

See the official doc here.

0

One tool I have used in the past is this which does a great job of rendering YAML/JSON and allows you to inspect the resulting output in order to validate.

0

I just run the code, e.g. Ansible or kubectl and if the yaml is incorrect these tools point out the line that contains the error. I never use a separate tool for validation the yaml.

0

There is a new tool available with Salt 3005 - yaml.lint

salt-call yaml.lint salt://example/bad_yaml.sls

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.