Update yamllint job to check metrics definitions
What does this MR do and why?
After finding (and fixing) a bunch of minor yamllint issues while working on CI templates, I realized we should probably lint them automatically in CI.
Related to !80703 (merged)
After scanning a few times, the main hurdle to linting with the current yamllint rules is that the metric yamls have different indentation for arrays than other places, and it's different depending on the use. For example:
options:
events:
- i_ecosystem_slack_service_push_notification
distribution:
- ee
- ce
The array under events:
is indented by 2, and the array under distribution is not indented (or indentation of 0). So the default yamllint rule doesn't work. As a compromise, I've decided to create a new job that extends the default rules the same way as the main project, but uses indentation: {spaces: 2, indent-sequences: whatever}
to make sure keys are properly nested, but arrays ("sequences", I think?) with different indentation is ignored.
- Example failed pipeline with defaults: https://gitlab.com/gitlab-org/gitlab/-/jobs/2249622695
- Example failed pipeline with
indentation: {spaces: 2, indent-sequences: consistent}
: https://gitlab.com/gitlab-org/gitlab/-/jobs/2249837294 - Example passed pipeline with
indentation: {spaces: 2, indent-sequences: whatever}
: https://gitlab.com/gitlab-org/gitlab/-/jobs/2249908823
In the future, we could potentially change all these YAML to have consistent array nesting, but that'll be messy MR, so let's start linting now to make sure nothing else creeps in, and address the arrays in the next iteration?
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.