openshift / api

Canonical location of the OpenShift API definition.
http://www.openshift.org
Apache License 2.0
94 stars 517 forks source link

Update schema checker and output info/warning level messages visually #2093

Closed JoelSpeed closed 14 hours ago

JoelSpeed commented 1 week ago

This PR updates schema checker, which for the first time returns infos and warnings, and then updates codegen to allow the various generators we use within it, to also return warnings and infos should they so desire.

Added a new structure for results, that can now be printed out in a slightly more colourful format, hopefully enabling easy distinction of the different results.

In the future we can update other generators, in particular, verifiers, to return more helpful information in a structured format, and potentially different output formats, maybe HTML?

Example of failure

openshift-ci[bot] commented 1 week ago

Skipping CI for Draft Pull Request. If you want CI signal for your change, please convert it to an actual PR. You can still manually trigger a test run with /test all

openshift-ci[bot] commented 1 week ago

Hello @JoelSpeed! Some important instructions when contributing to openshift/api: API design plays an important part in the user experience of OpenShift and as such API PRs are subject to a high level of scrutiny to ensure they follow our best practices. If you haven't already done so, please review the OpenShift API Conventions and ensure that your proposed changes are compliant. Following these conventions will help expedite the api review process for your PR.

JoelSpeed commented 1 week ago

/test verify-crd-schema /test verify

JoelSpeed commented 1 week ago

/test verify-crd-schema /test verify

JoelSpeed commented 1 week ago

/test verify-crd-schema /test verify

JoelSpeed commented 1 week ago

/test verify-crd-schema /test verify

JoelSpeed commented 1 week ago
----- config.openshift.io ----- v1 ----- config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_infrastructures-CustomNoUpgrade.crd.yaml -----
----- SCHEMACHECK -----
ERROR: ^.properties[spec].properties[platformSpec].properties[baremetal].properties[apiServerInternalIPs].items: Forbidden: estimated rule cost exceeds budget by factor of 1.8x (try simplifying the rule(s), or adding maxItems, maxProperties, and maxLength where arrays, maps, and strings are declared)
WARN: ^.spec.platformSpec.baremetal.apiServerInternalIPs: Array has unbounded maxItems. It will be considered to have 1048575 items. Consider adding a maxItems constraint to reduce the raw rule cost.
WARN: ^.spec.platformSpec.baremetal.apiServerInternalIPs[*]: Field has unbounded cardinality. At least one, variable parent field does not have a maxItems or maxProperties constraint: ^.spec.platformSpec.baremetal.apiServerInternalIPs. Falling back to CEL calculated worst case of 1048576 executions.
INFO: ^.spec.platformSpec.baremetal.apiServerInternalIPs[*]: Rule 0 raw cost is 17. Estimated total cost of 17825792. The maximum allowable value is 10000000. Rule is 178.26% of allowed budget.

New output demonstrated in https://prow.ci.openshift.org/view/gs/test-platform-results/pr-logs/pull/openshift_api/2093/pull-ci-openshift-api-master-verify-crd-schema/1856782506544599040, except, with colours in prow.

Errors still collated at the bottom, but at least now errors and warnings are all together and not mixed in among the rest of the logs

openshift-ci[bot] commented 1 week ago

@JoelSpeed: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/okd-scos-e2e-aws-ovn fec214046eda886050c69ce47587486266aa49ab link false /test okd-scos-e2e-aws-ovn

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
everettraven commented 15 hours ago

/lgtm

openshift-ci[bot] commented 15 hours ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: everettraven, JoelSpeed

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

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/openshift/api/blob/master/OWNERS)~~ [JoelSpeed] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
JoelSpeed commented 15 hours ago

/label acknowledge-critical-fixes-only

No effect on payload, tooling only

openshift-bot commented 8 hours ago

[ART PR BUILD NOTIFIER]

Distgit: ose-cluster-config-api This PR has been included in build ose-cluster-config-api-container-v4.19.0-202411212037.p0.gc98acdb.assembly.stream.el9. All builds following this will include this PR.