feat: Add Datadog schema hooks - #701
Conversation
- Add check-datadog-continuous-testing hook for datadog-ci.(json|yml|yaml) - Add check-datadog-service-definition hook for service.datadog.(json|yml|yaml) - Add check-datadog-software-catalog hook for entity.datadog.(json|yml|yaml) All three schemas are from DataDog/schema repository under Apache 2.0 license. Schemas support remote $ref dependencies which are resolved automatically.
sirosen
left a comment
There was a problem hiding this comment.
This seems like a perfectly good addition; can we add a bit of testing to make sure that the hooks are, and stay, in good working order?
You can see some tests for hook patterns here, and there's a suite of tests here which automatically check schemas against examples in tests/example-files/hooks/.
I also had a minor note for the changelog.
| ``check-datadog-service-definition``, and ``check-datadog-software-catalog``. | ||
| Thanks :user:`lannuttia`! (:issue:`702`, :pr:`701`) | ||
|
|
||
| .. vendor-insert-here |
There was a problem hiding this comment.
Minor, but let's put this note down below this comment; the vendoring script uses the comment to insert the Update vendored schemas: ... entries.
Add positive and negative example files for all three Datadog schema hooks: - datadog-continuous-testing (2 positive, 1 negative) - datadog-service-definition (3 positive, 1 negative) - datadog-software-catalog (4 positive, 1 negative) All positive examples validate successfully with the CLI tool. Some tests fail due to external schema refs blocked by HTTP mocking. Fixes CHANGELOG.rst placement (moved below vendor-insert-here marker). Addresses feedback from PR python-jsonschema#701 review.
|
It appears my positive tests are failing because the vendored schemas have external schema references and as a result are not self contained. The network isolation during the test suite prevents the schema from being downloaded over the network (as it should) and as a result is causing test failures. It looks like this is going to be more involved than I would have personally hoped. I don't know how exactly to solve this problem. If you have any ideas for how to proceed, I'm open to suggestions. If you don't have any ideas, I'll try to pick this up again soon and figure out what would be the best way to address this issue after I've had some time to sleep on the issue. |
Add Datadog schema hooks from https://github.com/DataDog/schema.
Closes #702.
This PR adds three new pre-commit hooks for validating Datadog configuration files:
check-datadog-continuous-testing- Validates Datadog Continuous Testing configuration filescheck-datadog-service-definition- Validates Datadog Service Definition filescheck-datadog-software-catalog- Validates Datadog Software Catalog entity filesAll schemas are sourced from the official DataDog/schema repository on GitHub.