[dmt] Validate package.yaml requirements#359
Open
diyliv wants to merge 2 commits into
Open
Conversation
f7d70d7 to
3eb672f
Compare
Signed-off-by: diyliv <onlogn081@gmail.com>
3eb672f to
abda470
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new Module linter rule to validate optional package.yaml metadata and enforce constraints for the new module requirements schema (including a minimum Deckhouse version when the new schema is detected).
Changes:
- Introduces
package-yamlrule: parsespackage.yaml, validates required metadata, validates semver constraints “as-is”, and enforcesrequirements.deckhouse.constraint >= 1.77.0when the new schema is used. - Adds unit tests covering parsing, metadata validation, constraint validation, and the Deckhouse-minimum requirement logic.
- Wires the new rule into module linter execution and global rule configuration, and documents the new rule in the module linter README.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/linters/module/rules/package_yaml.go | Implements the new package.yaml parsing + validation rule, including Deckhouse >= 1.77.0 enforcement for the new schema. |
| pkg/linters/module/rules/package_yaml_test.go | Adds test coverage for parsing and validation behaviors of the new rule. |
| pkg/linters/module/README.md | Documents the new package-yaml rule and updates the rules list/count and examples. |
| pkg/linters/module/module.go | Registers and runs the new package-yaml rule during module linting. |
| pkg/config/global/global.go | Adds package-yaml to global module rule configs (impact mapping). |
| pkg/config.go | Adds PackageYAMLRule to the runtime module linter rules config struct. |
| internal/module/module.go | Maps global rule impact configuration into the runtime PackageYAMLRule level. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+245
to
+252
| constraint, err := semver.NewConstraint(deckhouseConstraint) | ||
| if err != nil { | ||
| return | ||
| } | ||
|
|
||
| minAllowed := findMinimalAllowedVersion(constraint) | ||
|
|
||
| minimalVersion, err := semver.NewVersion(MinimalDeckhouseVersionForPackageRequirements) |
Comment on lines
+528
to
+530
| rules: | ||
| package-yaml: | ||
| impact: error # Override package.yaml validation level |
… rules section from README Signed-off-by: diyliv <onlogn081@gmail.com>
515b434 to
0b895cd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add package.yaml requirements validation for the new module requirements schema:
Example
Legacy markers in constraint fields are rejected: