Skip to content
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

Add krel validate cmd #3765

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

npolshakova
Copy link
Contributor

@npolshakova npolshakova commented Sep 17, 2024

What type of PR is this?

/kind feature

What this PR does / why we need it:

Introduces new krel validate <release-notes-maps> command for release notes team to use when checking for invalid formatting.

The release notes team is blocked whenever invalid yaml is merged into sig-release:

kubernetes/sig-release#2589
kubernetes/sig-release#2541

Invalid yaml can be introduced during the review process when people apply changes or manually edit the maps (not through krel, but in an editor).

Examples of runs:

Valid check:

krel validate sig-release/releases/release-1.30/release-notes/maps
...
Validating YAML file: sig-release/releases/release-1.30/release-notes/maps/pr-123935-map.yaml
File sig-release/releases/release-1.30/release-notes/maps/pr-123935-map.yaml is valid YAML.
YAML file sig-release/releases/release-1.30/release-notes/maps/pr-123935-map.yaml is valid.
Validating YAML file: sig-release/releases/release-1.30/release-notes/maps/pr-124001-map.yaml
File sig-release/releases/release-1.30/release-notes/maps/pr-124001-map.yaml is valid YAML.
YAML file sig-release/releases/release-1.30/release-notes/maps/pr-124001-map.yaml is valid.
All release notes are valid.

Invalid yaml:

Validating YAML file: sig-release/releases/release-1.30/release-notes/maps/pr-112957-map.yaml
FATA failed to validate release notes: YAML validation failed for sig-release/releases/release-1.30/release-notes/maps/pr-112957-map.yaml: YAML unmarshal failed for sig-release/releases/release-1.30/release-notes/maps/pr-112957-map.yaml:error converting YAML to JSON: yaml: line 3: found character that cannot start any token 

Which issue(s) this PR fixes:

Catches occurrences of #2753

Special notes for your reviewer:

Eventually, this command can be added to release-actions and run as a workflow similar to kubernetes/sig-release#2547.

Does this PR introduce a user-facing change?

Introduced new `krel validate` command for validating committed release note edits. 

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority labels Sep 17, 2024
@k8s-ci-robot k8s-ci-robot added area/release-eng Issues or PRs related to the Release Engineering subproject sig/release Categorizes an issue or PR as relevant to SIG Release. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 17, 2024
@npolshakova
Copy link
Contributor Author

@satyampsoni this can be used to validate the yamls instead of relying on the script. We can move this to a GitHub action once it goes in.

@npolshakova npolshakova force-pushed the npolshak/add-krel-validation-cmd branch from 9e25fc3 to 200851d Compare September 17, 2024 19:49
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 17, 2024
@npolshakova npolshakova force-pushed the npolshak/add-krel-validation-cmd branch from 200851d to 92cdea1 Compare September 17, 2024 19:50
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Sep 17, 2024
@npolshakova npolshakova force-pushed the npolshak/add-krel-validation-cmd branch from d9f13c0 to 2f93528 Compare September 17, 2024 20:09
@npolshakova npolshakova force-pushed the npolshak/add-krel-validation-cmd branch from 2f93528 to 21c7f05 Compare September 17, 2024 20:11
cmd/krel/cmd/validate.go Outdated Show resolved Hide resolved
cmd/krel/cmd/validate_test.go Outdated Show resolved Hide resolved
cmd/krel/cmd/validate.go Outdated Show resolved Hide resolved
cmd/krel/cmd/validate.go Show resolved Hide resolved
cmd/krel/cmd/validate.go Outdated Show resolved Hide resolved
cmd/krel/cmd/validate.go Outdated Show resolved Hide resolved
cmd/krel/cmd/validate.go Outdated Show resolved Hide resolved
cmd/krel/cmd/validate.go Show resolved Hide resolved
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: npolshakova
Once this PR has been reviewed and has the lgtm label, please ask for approval from xmudrii. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/release-eng Issues or PRs related to the Release Engineering subproject cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. needs-priority release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/release Categorizes an issue or PR as relevant to SIG Release. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants