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.

Pier
  • 344
  • 4
  • 16

4 Answers4

0

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

salt-call yaml.lint salt://example/bad_yaml.sls
OrangeDog
  • 113
  • 5
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.

Pier
  • 344
  • 4
  • 16
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.

James Shewey
  • 3,752
  • 1
  • 17
  • 38
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.

030
  • 13,383
  • 17
  • 76
  • 178