salty-dog is a YAML validation tool using JSON schema rules.
It can be used to validate Gitlab CI files, Grafana dashboards, and most other JSON/YAML files. Inspired by ESLint, checks are split up into rules and can be enabled individually or by group tags.
Status
salty-dog is actively maintained and mostly stable. There are a few additional features that I want to add, but most releases are security or regular updates. The rule syntax has been consistent since release, and schemas are implemented through ajv and the versioned JSON schema schemas.
Example
Rules are written in JSON schema and loaded from files. The core of each rule is the JSON schema to check
.
rules:
- name: kubernetes-deployment-replicas
desc: deployments must specify a positive replica count
level: info
tags:
- kubernetes
- apps
- deployment
# select the root of the document
select: '$'
# filter deployments
filter:
type: object
properties:
kind:
type: string
const: Deployment
# ensure replicas are greater than 0
check:
type: object
properties:
spec:
type: object
properties:
replica:
type: number
minimum: 1
The results can be summarized or formatted in a table:
[2022-05-29T23:07:53.049Z] INFO: salty-dog/2327 on 88d79993c018:
| rule | errors | changes |
| -------------------------------- | ------ | ------- |
| kubernetes-resources | 1 | 0 |
| kubernetes-resources-minimum-cpu | 0 | 0 |
| kubernetes-deployment-replicas | 0 | 0 |
| kubernetes-labels | 1 | 0 |
| kubernetes-container-pull-policy | 0 | 0 |
| kubernetes-image-latest | 0 | 0 |