-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add support for manifest V2 validations #9968
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
Conversation
9d75b63
to
3c576ab
Compare
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great!!! I left some inline questions/suggestions but nothing major.
datadog_checks_dev/datadog_checks/dev/tooling/commands/validate/manifest.py
Outdated
Show resolved
Hide resolved
echo_info(f'Skipping validation {validator} since errors have already been found.') | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 on continuing to list all validations that would be skipped instead of quickly aborting.
datadog_checks_dev/datadog_checks/dev/tooling/manifest_validator/__init__.py
Outdated
Show resolved
Hide resolved
datadog_checks_dev/datadog_checks/dev/tooling/manifest_validator/__init__.py
Outdated
Show resolved
Hide resolved
datadog_checks_dev/datadog_checks/dev/tooling/manifest_validator/common/validator.py
Outdated
Show resolved
Hide resolved
datadog_checks_dev/datadog_checks/dev/tooling/manifest_validator/common/validator.py
Outdated
Show resolved
Hide resolved
|
||
FIELDS_NOT_ALLOWED_TO_CHANGE = { | ||
"v1": ("integration_id", "display_name", "guid"), | ||
"v2": ("id", "source_type_name", "app_id"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these v2 versions need to be assets/integration/id
, ``assets/integration/source_type_name, and
app_id`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The content_changed
function below just returns git blocks which are what are being tested - so we wouldn't be able to fully trace a path like assets/integration/id
. It does mean we could end up catching other id fields in this case though ..
datadog_checks_dev/datadog_checks/dev/tooling/manifest_validator/v1/validator.py
Show resolved
Hide resolved
datadog_checks_dev/datadog_checks/dev/tooling/manifest_validator/v2/validator.py
Outdated
Show resolved
Hide resolved
datadog_checks_dev/datadog_checks/dev/tooling/manifest_validator/v2/validator.py
Outdated
Show resolved
Hide resolved
datadog_checks_dev/datadog_checks/dev/tooling/manifest_validator/__init__.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this LGTM
f093623
to
99853cf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
@@ -89,3 +89,52 @@ def __exit__(self, exc_type, exc_value, traceback): | |||
self._cleanup(self.directory) | |||
else: | |||
self._cleanup(self.directory) | |||
|
|||
|
|||
class JSONDict(dict): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move this under tooling/
instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, and since we are under that tooling dir, added back the jsonpointer
dependency to the cli
extras 😝
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move this under
tooling/
instead
Done, and since we are under that tooling dir, added back thejsonpointer
dependency to thecli
extras 😝
Oh wait, can we still not do that? It's quite unnecessary
What does this PR do?
Adds support for validating Manifest v2 files.
For v2, we have the actual schema validation taking place on the Datadog app side via a new endpoint that's been created. This runs through a JSONSchema serializer, then applies basic validations against the payload. Since we will also be doing this validation within the app, it seemed like a better choice to avoid the schema duplication across different repos and projects with the risk of things getting out of sync.
Motivation
Add support for new manifest versions.
Additional Notes
A valid API and APP key will need to be added to the ddev config when validating the new manifests.
Tests continue to pass for v1, but additional tests are needed for v2.
To test manually, create a folder named
testmanifest
and add the following file:manifest.json
To test the server side validation, try changing the classifier tag
Offering::UI Extension
toOffering::UI-Extension
or some nonsense name.Review checklist (to be filled by reviewers)
changelog/
andintegration/
labels attached