-
Notifications
You must be signed in to change notification settings - Fork 57
introduce crd-schema-checker #1055
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
base: main
Are you sure you want to change the base?
Conversation
a002f63 to
a5334e7
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1055 +/- ##
==========================================
+ Coverage 77.69% 77.80% +0.10%
==========================================
Files 44 44
Lines 2834 2834
==========================================
+ Hits 2202 2205 +3
+ Misses 525 522 -3
Partials 107 107 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
26f855e to
e4babbe
Compare
3d32594 to
085fd03
Compare
|
I updated this, it was pretty broken before. Now it actually outputs all the errors, warnings and info messages and has a proper global error count, and a separate one for errors in stable APIs (as only those will fail the check) |
085fd03 to
0063f73
Compare
| @test -s $(LOCALBIN)/misspell || GOBIN=$(LOCALBIN) go install github.com/client9/misspell/cmd/misspell@$(MISSPELL_VERSION) | ||
|
|
||
| .PHONY: crd-schema-checker | ||
| crd-schema-checker: $(CRD_SCHEMA_CHECKER) ## Download crd-schema-checker to bin directory. |
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.
Why even have the phony target?
It seems to me lint-crds can just depend on $(CRD_SCHEMA_CHECKER) directly
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.
technically yes, but that's how we're doing it for all other tools as well
| echo " - $line" | ||
| done <<< "$output" | ||
| fi | ||
| echo "--> ${errors} errors, ${warnings} warnings, ${infos} infos" |
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.
Why is it pertinent to count the errors/warn/info here?
Wouldn't it make more sense to push a PR to print that in the original command anyway?
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.
yeah we need to count, if only to separate them by stable vs. non-stable APIs- we can allow breaking changes in v1alpha1 CRDs, but never in v1 CRDs, for example
|
|
||
| version=$(getLatestCRDVersion "${current_crd_map[$crd]}") | ||
| output_result "${crd}" "${version}" "${output}" | ||
| CHECKED_CRDS=$((CHECKED_CRDS + 1)) |
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.
| CHECKED_CRDS=$((CHECKED_CRDS + 1)) | |
| ((CHECKED_CRDS++)) |
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.
fixed
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 understand there is no practical difference between the two. I noticed your comment fixed - did you forget to update the PR?
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.
oh, that was a mistake. I tried this and it didn't work I think
| echo "=== Results ===" | ||
| echo "Checked $CHECKED_CRDS CRDs: $ERRORS errors ($STABLE_ERRORS errors in stable APIs), $WARNINGS warnings, $INFOS infos" | ||
|
|
||
| if [[ $STABLE_ERRORS -gt 0 ]]; then |
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.
Generally to me parsing the output seems like the wrong approach.
We have the exit code of the checks, we should rely on those instead of trying to read and interpret the output.
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.
again, we need to parse to get detailed results - warnings we can always ignore, for pre-release CRDs we can even ignore errors. yes, technically we could do all that based on just exit codes but we wouldn't be able to produce detailed counts
|
/retest |
|
This seems to be a legitimate error: Did we forget to add 1.26.1 on the 1.27 branch? |
0063f73 to
fc2bcf3
Compare
We have previously released a version on the 1.26 stream that supported 1.26.1. In order to not break API guarantees, that enum value of 1.26.1 has to be supported in later releases as well, so I'm adding it here. This problem was found with the crd-schema-checker introduced in istio-ecosystem#1055. Signed-off-by: Daniel Grimm <[email protected]>
fc2bcf3 to
8fb3f20
Compare
This was indeed the case. First legit problem the checker found 👍 Fix is in #1228, until it merges the lint job will fail on this PR. |
We have previously released a version on the 1.26 stream that supported 1.26.1. In order to not break API guarantees, that enum value of 1.26.1 has to be supported in later releases as well, so I'm adding it here. This problem was found with the crd-schema-checker introduced in #1055. Signed-off-by: Daniel Grimm <[email protected]>
|
/retest |
|
|
||
| version=$(getLatestCRDVersion "${current_crd_map[$crd]}") | ||
| output_result "${crd}" "${version}" "${output}" | ||
| CHECKED_CRDS=$((CHECKED_CRDS + 1)) |
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 understand there is no practical difference between the two. I noticed your comment fixed - did you forget to update the PR?
| version=$(getLatestCRDVersion "${previous_crd_map[$crd]}") | ||
| if ! isStableVersion "$version"; then | ||
| echo "WARNING: CRD $crd was removed ($version)" | ||
| WARNINGS=$((WARNINGS + 1)) |
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.
nit: In case you want to make the same change here as well as in Line 166 below.
|
LGTM, not approving to wait for other comments to be resolved. |
8fb3f20 to
b4e4ede
Compare
|
currently if not on a release branch, the linter will compare the last two release branches. We should change that to compare the current HEAD against the latest release branch |
b4e4ede to
2be5426
Compare
|
lint job will fail until #1301 is merged |
This is a script that uses openshift/crd-schema-checker to verify that we're not breaking any CRD API guarantees across releases. Signed-off-by: Daniel Grimm <[email protected]>
2be5426 to
ea7193b
Compare
|
/retest |
This is a script that uses openshift/crd-schema-checker to verify that we're not breaking any CRD API guarantees across releases.
We can't merge this until we fix the errors, but it's pretty neat.