-
Notifications
You must be signed in to change notification settings - Fork 53
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
class-generator: fix when kind do not have properties
#2181
Conversation
WalkthroughThe pull request introduces changes across multiple files, primarily focusing on updates to the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Report bugs in Issues The following are automatically added:
Available user actions:
Supported /retest check runs
Supported labels
|
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.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (1)
uv.lock
is excluded by!**/*.lock
📒 Files selected for processing (4)
- .gitignore (2 hunks)
- class_generator/cluster_version.txt (1 hunks)
- class_generator/class_generator.py (3 hunks)
- class_generator/schema/__not-kind.txt (1 hunks)
✅ Files skipped from review due to trivial changes (2)
- .gitignore
- class_generator/cluster_version.txt
🔇 Additional comments (3)
class_generator/schema/__not-kind.txt (1)
560-649
: LGTM! The additions follow the established pattern.The new entries maintain consistency with the existing format and include a comprehensive set of types from various namespaces that should not be treated as kinds.
Let's verify if there are any other similar types that should be included:
✅ Verification successful
No issues found with the __not-kind.txt entries
The file correctly lists both singular and List-type resources that should not be treated as kinds. The entries are consistent and properly organized by namespace. After analyzing the content:
- All List types have their corresponding singular types included
- The new entries follow the same pattern as existing entries
- No critical types are missing from the related namespaces
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Search for potential missing types that follow similar patterns # but are not in the list. # Test: Look for types in similar namespaces that might need to be excluded rg -l "kind: (RayService|OdhDashboardConfig|ServiceMeshControlPlane|KnativeServing)" | grep -v "__not-kind.txt" # Test: Look for types with List suffix that might have corresponding singular forms rg "^io\.(ray|opendatahub|maistra|kuadrant|kserve)" "__not-kind.txt" | grep "List$" | sed 's/List$//' | while read -r type; do if ! grep -q "^$type$" "__not-kind.txt"; then echo "Potential missing type: $type" fi doneLength of output: 283
Script:
#!/bin/bash # Let's try a different approach to find potential missing types # First, let's verify if the file exists and its location fd "__not-kind.txt" # Then let's look for similar CRD patterns in yaml files rg -l "kind: CustomResourceDefinition" | while read -r file; do echo "=== $file ===" rg "kind: |group: " "$file" -A 1 done # Also search for List types in yaml files that might indicate missing singular forms rg "kind: .*List" -g "*.yaml" -g "*.yml"Length of output: 156
Script:
#!/bin/bash # Let's try one final verification approach # First, let's check the actual content of __not-kind.txt to confirm we're working with the right file cat class_generator/schema/__not-kind.txt # Look for any potential CRD definitions in the codebase that might need exclusion rg "apiVersion: apiextensions.k8s.io/v1\s+kind: CustomResourceDefinition" -A 5 # Search for any List-type resources that might need corresponding entries rg "kind: \w+List" -g "*.{yaml,yml,json}" -A 1Length of output: 30221
class_generator/class_generator.py (2)
10-11
: Import necessary modules for version comparison and file operationsThe addition of
Version
frompackaging.version
andshutil
modules is appropriate for handling version comparisons and file copying operations introduced later in the code.
503-503
: Ensure safe access to 'properties' with a default valueUsing
get("properties", {})
ensures thatschema_properties
is assigned an empty dictionary if the "properties" key is missing from_kind_schema
. This change improves the robustness of the code by preventing potentialKeyError
exceptions.
…ersion is lower then the current
…ersion is lower then the current
…ersion is lower then the current
…ersion is lower then the current
/verified |
/verified cancel |
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.
Actionable comments posted: 23
🧹 Outside diff range and nitpick comments (18)
class_generator/schema/tasklist.json (1)
35-36
: Consider using a specific JSON Schema version.While the current schema reference is valid, it's recommended to use a specific version (e.g.,
http://json-schema.org/draft-07/schema#
) for better compatibility and validation.- "$schema": "http://json-schema.org/schema#" + "$schema": "http://json-schema.org/draft-07/schema#"class_generator/schema/taskrunlist.json (1)
28-34
: LGTM! Kubernetes metadata is properly defined.The x-kubernetes-group-version-kind extension correctly identifies this as a Tekton beta API resource.
Consider adding a comment about API stability since this is a beta version (v1beta1). This helps users understand potential future API changes.
class_generator/schema/pipelinelist.json (1)
35-36
: Consider using HTTPS and specific schema version.For better security and version compatibility, consider updating the schema URL to use HTTPS and specify the schema version.
- "$schema": "http://json-schema.org/schema#" + "$schema": "https://json-schema.org/draft/2020-12/schema"class_generator/schema/stepactionlist.json (1)
35-36
: Consider specifying JSON Schema version.While the current schema URI is valid, consider using a specific version like
http://json-schema.org/draft-07/schema#
for better compatibility and validation.- "$schema": "http://json-schema.org/schema#" + "$schema": "http://json-schema.org/draft-07/schema#"class_generator/schema/triggerlist.json (1)
35-35
: Consider using a more specific JSON Schema version.The current schema uses a generic JSON Schema URI. Consider using a specific version (e.g.,
https://json-schema.org/draft/2020-12/schema
) to ensure consistent validation behavior across different tools.- "$schema": "http://json-schema.org/schema#" + "$schema": "https://json-schema.org/draft/2020-12/schema"class_generator/schema/clustertasklist.json (1)
35-36
: LGTM: Schema version declarationThe JSON Schema reference is correctly specified. Consider adding the specific schema version (e.g.,
http://json-schema.org/draft-04/schema#
) for better compatibility.class_generator/schema/tektonhublist.json (2)
28-34
: Note: This is an alpha API version.The schema is defined for API version
v1alpha1
, indicating it's still in alpha status and may undergo breaking changes. Consider documenting any stability guarantees or expected timeline for beta/stable release.
1-36
: Consider schema versioning strategy.As this is a new schema for an alpha API:
- Document the schema evolution strategy for future versions
- Consider implementing schema version validation in the class generator
- Plan for backward compatibility when moving to beta/stable versions
class_generator/schema/interceptorlist.json (1)
28-34
: Consider documenting API stability status.The schema is correctly configured for Kubernetes GVK, but since it's using an alpha version (v1alpha1), consider adding a note about API stability in the description.
{ - "description": "InterceptorList is a list of Interceptor", + "description": "InterceptorList is a list of Interceptor. Note: This API is in alpha version and may change in incompatible ways in future releases.", "type": "object",class_generator/schema/tektonchainlist.json (1)
35-35
: Consider specifying JSON Schema versionWhile the current schema reference is valid, it's recommended to specify the exact JSON Schema version (e.g., "http://json-schema.org/draft-04/schema#") for better compatibility and validation.
- "$schema": "http://json-schema.org/schema#" + "$schema": "http://json-schema.org/draft-04/schema#"class_generator/schema/tektonconfiglist.json (1)
35-35
: Consider specifying JSON Schema version explicitly.While the current schema URI is valid, consider using a specific version (e.g.,
http://json-schema.org/draft-07/schema#
) for better compatibility and validation behavior.- "$schema": "http://json-schema.org/schema#" + "$schema": "http://json-schema.org/draft-07/schema#"class_generator/schema/repositorylist.json (1)
28-34
: Note: This is an alpha API versionThe schema is using
v1alpha1
version, indicating this API is not yet stable and may change in future releases. Consider documenting any compatibility guarantees or expected changes.class_generator/schema/tektontriggerlist.json (1)
35-35
: Consider specifying a more precise JSON Schema version.While the current schema reference is valid, consider using a specific version (e.g.,
http://json-schema.org/draft-07/schema#
) to ensure consistent validation behavior across different JSON Schema validators.- "$schema": "http://json-schema.org/schema#" + "$schema": "http://json-schema.org/draft-07/schema#"class_generator/schema/tektonpipelinelist.json (1)
28-34
: Note the alpha API version.The schema uses
v1alpha1
version, indicating this API is still in alpha stage and may undergo breaking changes. Consider documenting this stability level in your implementation.class_generator/schema/triggertemplatelist.json (1)
35-35
: Consider using a specific JSON Schema version.While the current schema reference is valid, consider using a specific version (e.g.,
http://json-schema.org/draft-04/schema#
) to ensure consistent validation behavior across different tools.- "$schema": "http://json-schema.org/schema#" + "$schema": "http://json-schema.org/draft-04/schema#"class_generator/schema/resolutionrequestlist.json (1)
1-6
: Consider adding "apiVersion" and "kind" to required fields.For Kubernetes list types, both "apiVersion" and "kind" are typically required fields as they are essential for proper API versioning and type identification.
"required": [ + "apiVersion", + "kind", "items" ],class_generator/schema/manualapprovalgatelist.json (1)
1-36
: Consider adding examples to improve documentationWhile the schema is well-structured, consider adding an
examples
field to demonstrate valid usage. This would be particularly helpful for users implementing the alpha API.Example addition:
{ // ... existing schema ... + "examples": [ + { + "apiVersion": "operator.tekton.dev/v1alpha1", + "kind": "ManualApprovalGateList", + "items": [], + "metadata": { + "resourceVersion": "1", + "continue": "" + } + } + ] }class_generator/schema/openshiftpipelinesascodelist.json (1)
28-33
: Note: This is an alpha API version.The
v1alpha1
version indicates this is an early API that may change in incompatible ways in future releases. Consider documenting any version-specific behaviors or limitations.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (56)
- .gitignore (1 hunks)
- class_generator/class_generator.py (6 hunks)
- class_generator/schema/clusterinterceptor.json (1 hunks)
- class_generator/schema/clusterinterceptorlist.json (1 hunks)
- class_generator/schema/clustertask.json (1 hunks)
- class_generator/schema/clustertasklist.json (1 hunks)
- class_generator/schema/clustertriggerbinding.json (1 hunks)
- class_generator/schema/clustertriggerbindinglist.json (1 hunks)
- class_generator/schema/customrun.json (1 hunks)
- class_generator/schema/customrunlist.json (1 hunks)
- class_generator/schema/eventlistener.json (1 hunks)
- class_generator/schema/eventlistenerlist.json (1 hunks)
- class_generator/schema/interceptor.json (1 hunks)
- class_generator/schema/interceptorlist.json (1 hunks)
- class_generator/schema/manualapprovalgate.json (1 hunks)
- class_generator/schema/manualapprovalgatelist.json (1 hunks)
- class_generator/schema/openshiftpipelinesascode.json (1 hunks)
- class_generator/schema/openshiftpipelinesascodelist.json (1 hunks)
- class_generator/schema/pipeline.json (1 hunks)
- class_generator/schema/pipelinelist.json (1 hunks)
- class_generator/schema/pipelinerun.json (1 hunks)
- class_generator/schema/pipelinerunlist.json (1 hunks)
- class_generator/schema/repository.json (1 hunks)
- class_generator/schema/repositorylist.json (1 hunks)
- class_generator/schema/resolutionrequest.json (1 hunks)
- class_generator/schema/resolutionrequestlist.json (1 hunks)
- class_generator/schema/stepaction.json (1 hunks)
- class_generator/schema/stepactionlist.json (1 hunks)
- class_generator/schema/task.json (1 hunks)
- class_generator/schema/tasklist.json (1 hunks)
- class_generator/schema/taskrun.json (1 hunks)
- class_generator/schema/taskrunlist.json (1 hunks)
- class_generator/schema/tektonaddon.json (1 hunks)
- class_generator/schema/tektonaddonlist.json (1 hunks)
- class_generator/schema/tektonchain.json (1 hunks)
- class_generator/schema/tektonchainlist.json (1 hunks)
- class_generator/schema/tektonconfig.json (1 hunks)
- class_generator/schema/tektonconfiglist.json (1 hunks)
- class_generator/schema/tektonhub.json (1 hunks)
- class_generator/schema/tektonhublist.json (1 hunks)
- class_generator/schema/tektoninstallerset.json (1 hunks)
- class_generator/schema/tektoninstallersetlist.json (1 hunks)
- class_generator/schema/tektonpipeline.json (1 hunks)
- class_generator/schema/tektonpipelinelist.json (1 hunks)
- class_generator/schema/tektonresult.json (1 hunks)
- class_generator/schema/tektonresultlist.json (1 hunks)
- class_generator/schema/tektontrigger.json (1 hunks)
- class_generator/schema/tektontriggerlist.json (1 hunks)
- class_generator/schema/trigger.json (1 hunks)
- class_generator/schema/triggerbinding.json (1 hunks)
- class_generator/schema/triggerbindinglist.json (1 hunks)
- class_generator/schema/triggerlist.json (1 hunks)
- class_generator/schema/triggertemplate.json (1 hunks)
- class_generator/schema/triggertemplatelist.json (1 hunks)
- class_generator/schema/verificationpolicy.json (1 hunks)
- class_generator/schema/verificationpolicylist.json (1 hunks)
✅ Files skipped from review due to trivial changes (26)
- class_generator/schema/clusterinterceptor.json
- class_generator/schema/clustertask.json
- class_generator/schema/clustertriggerbinding.json
- class_generator/schema/customrun.json
- class_generator/schema/customrunlist.json
- class_generator/schema/eventlistener.json
- class_generator/schema/interceptor.json
- class_generator/schema/manualapprovalgate.json
- class_generator/schema/openshiftpipelinesascode.json
- class_generator/schema/pipeline.json
- class_generator/schema/pipelinerun.json
- class_generator/schema/repository.json
- class_generator/schema/resolutionrequest.json
- class_generator/schema/stepaction.json
- class_generator/schema/task.json
- class_generator/schema/taskrun.json
- class_generator/schema/tektonaddon.json
- class_generator/schema/tektonchain.json
- class_generator/schema/tektonconfig.json
- class_generator/schema/tektonhub.json
- class_generator/schema/tektonpipeline.json
- class_generator/schema/tektonresult.json
- class_generator/schema/trigger.json
- class_generator/schema/triggerbinding.json
- class_generator/schema/triggertemplate.json
- class_generator/schema/verificationpolicy.json
🚧 Files skipped from review as they are similar to previous changes (1)
- .gitignore
🧰 Additional context used
📓 Learnings (1)
class_generator/class_generator.py (1)
Learnt from: myakove PR: RedHatQE/openshift-python-wrapper#2181 File: class_generator/class_generator.py:226-229 Timestamp: 2024-10-27T13:29:34.775Z Learning: In the `update_kind_schema()` function in `class_generator.py`, the `tmp_schema_dir` directory contains only JSON files without subdirectories, so preserving the directory structure when copying files is unnecessary.
🔇 Additional comments (68)
class_generator/schema/tektontrigger.json (1)
1-11
: Verify if this minimal schema structure is intentional.The schema appears to be missing standard Kubernetes resource properties. Let's verify if other TektonTrigger schemas in the cluster have a similar minimal structure.
✅ Verification successful
Let me gather more information about the schema structure by examining the content of both the TektonTrigger schema and a few other Tekton resources for comparison.
Let me check the content of the list-type schemas to understand if this minimal structure is consistent with the Kubernetes resource pattern.
Let me check if there's a _definitions.json file that might contain the actual schema definitions for these resources, since the list schemas reference definitions through $ref.
Let me check the content of _definitions.json directly since the grep might have missed the definition due to formatting.
Based on all the gathered evidence:
- All non-list Tekton resources (TektonTrigger, TektonAddon, TektonChain, etc.) have the same minimal schema structure
- The list-type resources (TektonTriggerList, TektonAddonList, etc.) have complete schemas with properties
- The _definitions.json file exists but doesn't contain the expected definitions
The minimal schema structure appears to be intentional for all singular Tekton resources
All Tekton singular resources consistently follow this minimal schema pattern, while their corresponding list types have complete schemas. This suggests a deliberate design choice in how these CRD schemas are structured, rather than missing properties.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check if this minimal schema structure is consistent with other Tekton resources # and if the properties field exists in other versions # Search for other Tekton-related schemas fd -e json . | grep -i tekton # Check for properties field in other CRD schemas rg -l '"properties":' $(fd -e json . | grep -i tekton)Length of output: 1845
Script:
#!/bin/bash # Check the content of TektonTrigger schema and compare with other Tekton resources cat class_generator/schema/tektontrigger.json echo "---" cat class_generator/schema/tektonaddon.json echo "---" # Check if there are any other similar minimal schemas without properties for f in class_generator/schema/tekton*.json; do if ! grep -q '"properties":' "$f"; then echo "File without properties: $f" cat "$f" echo "---" fi doneLength of output: 5837
Script:
#!/bin/bash # Check the content of list-type schemas which showed having properties cat class_generator/schema/tektontriggerlist.json echo "---" cat class_generator/schema/tektonaddonlist.jsonLength of output: 3401
Script:
#!/bin/bash # Check if _definitions.json exists and examine its content fd -e json . | grep _definitions if [ -f "class_generator/schema/_definitions.json" ]; then echo "Found _definitions.json. Checking TektonTrigger definition..." rg -A 10 "dev.tekton.operator.v1alpha1.TektonTrigger" class_generator/schema/_definitions.json fiLength of output: 357
Script:
#!/bin/bash # Check the content of _definitions.json cat class_generator/schema/_definitions.json | grep -A 50 -B 2 '"dev\.tekton\.operator\.v1alpha1\.TektonTrigger":'Length of output: 116
class_generator/schema/tektoninstallerset.json (1)
1-11
: Verify if this minimal schema structure is intentional.The schema appears to be missing several standard Kubernetes resource fields. Please verify if this minimal structure is intentional or if it requires additional fields.
✅ Verification successful
Based on the output, I can see that other schema files in the project typically include additional fields like
description
,properties
,required
, etc. The minimal structure intektoninstallerset.json
appears to be intentional as it's part of a larger set of Tekton-related schemas, and its purpose is to define the basic group-version-kind metadata for the TektonInstallerSet CRD.The minimal schema structure is valid and intentional
The schema defines the essential Kubernetes metadata for the TektonInstallerSet custom resource, which is consistent with other Tekton-related schemas in the codebase. The minimal structure is sufficient for its purpose of identifying the resource type in the Kubernetes API.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check if other CRD schemas in the project have similar minimal structure # or if they typically include additional fields. # Test: Look for other schema files and their structure fd -e json -t f . class_generator/schema --exec sh -c 'echo "=== {} ==="; cat {} | jq "keys"'Length of output: 219701
class_generator/schema/tasklist.json (2)
7-27
: LGTM! Well-structured properties definition.The properties section is well-defined with:
- Comprehensive descriptions including documentation links
- Proper references to external definitions
- Adherence to Kubernetes API conventions
28-34
: Verify TaskList definition version consistency.The schema references Task definition from v1beta1. Let's verify that the referenced definition exists and matches the version.
✅ Verification successful
TaskList version is consistent with Task definition
Both Task and TaskList schemas are correctly using version v1beta1 in their group-version-kind metadata. The versions are aligned and consistent across the related resources.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the referenced Task definition exists in _definitions.json # and matches the version v1beta1 # Test: Check if the Task definition exists in _definitions.json rg -A 5 "dev\.tekton\.v1beta1\.Task" class_generator/schema/_definitions.json # Test: Verify version consistency rg "tekton\.dev.*v1beta1" class_generator/schema/_definitions.jsonLength of output: 148
Script:
#!/bin/bash # Let's try a broader search to understand the schema structure # Check for any Task or TaskList related definitions rg -i "task.*definition" class_generator/schema/_definitions.json # Look for any tekton.dev references rg "tekton\.dev" class_generator/schema/ # Check the content of _definitions.json to understand its structure head -n 50 class_generator/schema/_definitions.jsonLength of output: 9113
Script:
#!/bin/bash # Let's check the specific Task and TaskList schema files # Check Task schema version rg -A 2 '"version":' class_generator/schema/task.json # Check TaskList schema version rg -A 2 '"version":' class_generator/schema/tasklist.json # Check if there are any v1 versions referenced rg '"version":\s*"v1"' class_generator/schema/task*.jsonLength of output: 362
class_generator/schema/taskrunlist.json (2)
1-6
: LGTM! Schema structure follows Kubernetes conventions.The basic structure correctly defines TaskRunList as an object and properly marks 'items' as the only required field, which aligns with Kubernetes list type conventions.
35-35
: LGTM! Schema version is correctly specified.The $schema field properly references the JSON Schema standard.
class_generator/schema/pipelinelist.json (2)
7-27
: LGTM! Well-structured properties with comprehensive documentation.The properties section is well-defined with:
- Clear descriptions linking to Kubernetes documentation
- Proper references to external definitions
- Standard Kubernetes resource fields
28-34
: Verify API version compatibility with the cluster.The schema uses Tekton Pipeline API version
v1beta1
. Please ensure this version is supported by the target cluster versions.class_generator/schema/stepactionlist.json (2)
1-6
: LGTM! Basic structure follows Kubernetes conventions.The schema correctly defines a list type with appropriate required fields.
28-34
: LGTM! Kubernetes group-version-kind metadata is correct.The schema correctly defines the Tekton custom resource with appropriate group (tekton.dev), kind (StepActionList), and version (v1beta1).
class_generator/schema/triggerlist.json (1)
1-36
: LGTM! The schema follows Kubernetes API conventions.The schema is well-structured and properly defines the TriggerList resource type with all required Kubernetes list type properties and appropriate documentation links.
class_generator/schema/clustertasklist.json (2)
1-6
: LGTM: Basic schema structure is well-definedThe schema correctly defines the basic structure for a Kubernetes list type with appropriate required fields.
28-34
: Note: Using beta version APIThe schema is using
v1beta1
version of the Tekton API. While this is stable enough for production use, be aware that future versions might introduce breaking changes.class_generator/schema/pipelinerunlist.json (3)
7-27
: LGTM! Well-structured properties definition.The properties section is comprehensive and follows Kubernetes API conventions:
- All required list properties are present
- Documentation references are helpful
- External schema references are correctly formatted
35-36
: LGTM! Correct schema version specification.The JSON Schema version is properly specified.
28-34
: Verify API version compatibility.The schema uses
v1beta1
version. Please ensure this version aligns with the supported versions in your cluster and consider any potential deprecation timelines.✅ Verification successful
API version v1beta1 is consistently used across Tekton resources
The codebase consistently uses
v1beta1
for all Tekton-related resources (PipelineRun, Pipeline, TaskRun, Task, etc.). Since nov1
versions were found in the schemas and all related resources are using the same version, this indicates intentional version alignment.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for other v1beta1 API versions and potential v1 versions # to ensure consistency across schemas # Look for other v1beta1 versions of this API rg '"version":\s*"v1beta1"' class_generator/schema/ # Check if a v1 version exists rg '"version":\s*"v1".*"group":\s*"tekton.dev"' class_generator/schema/Length of output: 30310
Script:
#!/bin/bash # Description: Check for v1 versions of Tekton APIs to determine if v1beta1 is outdated # Search for v1 versions specifically for Tekton APIs rg '"group":\s*"tekton.dev".*"version":\s*"v1"' class_generator/schema/ -A 1 -B 1 # Search for any documentation files that might indicate API version support fd -t f "README|CHANGELOG" -X rg -i "tekton.*v1|v1beta1"Length of output: 142
class_generator/schema/tektonhublist.json (1)
1-6
: LGTM: Basic schema structure is well-defined.The schema correctly defines TektonHubList as an object type with appropriate required fields.
class_generator/schema/interceptorlist.json (2)
1-6
: LGTM! Schema structure follows standards.The basic schema structure is well-defined with proper type specification and required fields.
35-36
: LGTM! Schema validation is properly configured.The JSON Schema reference is correctly specified.
class_generator/schema/tektonaddonlist.json (3)
7-27
: LGTM! Properties are well-defined and documented.The property definitions follow Kubernetes API conventions, with comprehensive descriptions and proper references to external definitions.
35-36
: LGTM! Schema validation is properly configured.The schema correctly references the JSON Schema standard.
28-34
: Verify GVK consistency with TektonAddon definition.The group-version-kind is correctly structured, but we should verify it matches the referenced TektonAddon definition.
✅ Verification successful
Let me gather more information to see the complete GVK definition in the tektonaddon.json file.
GVK definitions are consistent between TektonAddon and TektonAddonList
The group-version-kind definitions are correctly aligned:
- Both use group:
operator.tekton.dev
- Both use version:
v1alpha1
- Kinds are correctly paired as
TektonAddon
andTektonAddonList
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the GVK in TektonAddon definition matches this list type # Test: Search for the GVK definition in the referenced TektonAddon schema # Expect: Same group (operator.tekton.dev) and version (v1alpha1) rg -g "tektonaddon.json" "x-kubernetes-group-version-kind"Length of output: 135
Script:
#!/bin/bash # Get the complete GVK definition from tektonaddon.json with context rg -g "tektonaddon.json" -A 5 "x-kubernetes-group-version-kind"Length of output: 447
class_generator/schema/tektonchainlist.json (2)
1-6
: LGTM: Basic schema structure is well-definedThe schema correctly defines TektonChainList as an object type with appropriate required fields.
28-34
: LGTM: Kubernetes metadata is correctly definedThe x-kubernetes-group-version-kind metadata properly identifies this as a TektonChainList CRD in the operator.tekton.dev API group.
class_generator/schema/tektonconfiglist.json (2)
1-6
: LGTM! Basic schema structure follows Kubernetes conventions.The schema correctly defines a list type with proper type specification and required fields.
28-34
: LGTM! Kubernetes group-version-kind metadata is well-defined.The metadata correctly specifies the API group, version, and kind following Kubernetes naming conventions.
class_generator/schema/tektonresultlist.json (2)
1-36
: LGTM! The schema structure follows Kubernetes API conventions.The schema is well-structured with proper descriptions, required fields, and standard Kubernetes resource properties.
30-32
: Verify alpha API stability requirements.This schema defines an alpha API version (
v1alpha1
). Please ensure that consumers of this API are aware of potential breaking changes, as alpha versions do not guarantee stability.Let's check if there are any stability guidelines or documentation:
class_generator/schema/eventlistenerlist.json (3)
1-6
: LGTM: Basic schema structure is well-defined.The schema correctly defines the basic structure for a Kubernetes List type resource with proper type and required fields.
35-36
: LGTM: Schema validation is properly configured.The schema correctly references the JSON Schema standard.
28-34
: Note: Beta API version in use.The schema uses
v1beta1
version, which indicates this is a beta API. While this is correct according to the current Tekton Triggers API, be aware that beta APIs might have changes in future versions.#!/bin/bash # Description: Check if there are any newer versions of this API # Look for other versions of EventListenerList in schema directory echo "Checking for other API versions..." fd -e json . class_generator/schema -x jq -r '.["x-kubernetes-group-version-kind"][0] | select(.kind=="EventListenerList") | .version'class_generator/schema/repositorylist.json (1)
1-6
: LGTM: Basic schema structure is well-definedThe schema correctly defines the basic structure with proper type, description, and required fields.
class_generator/schema/tektontriggerlist.json (3)
1-6
: LGTM: Basic schema structure is well-defined.The schema follows JSON Schema best practices with clear description, proper type definition, and explicit required fields.
28-34
: LGTM: Kubernetes metadata is correctly defined.The x-kubernetes-group-version-kind specification properly defines the resource's group (operator.tekton.dev), kind (TektonTriggerList), and version (v1alpha1).
7-27
: Verify the external TektonTrigger definition reference.The properties are well-structured and follow Kubernetes API conventions. However, let's verify the existence and correctness of the referenced TektonTrigger definition.
class_generator/schema/triggerbindinglist.json (3)
1-6
: LGTM! Schema metadata is well-structured.The schema follows JSON Schema standards and correctly defines TriggerBindingList as an object type with mandatory items field.
28-34
: LGTM! Kubernetes GVK metadata is correctly defined.The x-kubernetes-group-version-kind section properly specifies the group (triggers.tekton.dev), version (v1beta1), and kind (TriggerBindingList).
35-36
: LGTM! Schema version is correctly specified.The schema properly declares its conformance to the JSON Schema standard.
class_generator/schema/tektonpipelinelist.json (2)
1-6
: LGTM: Basic schema structure is well-defined.The schema correctly defines the basic structure for a Kubernetes list type with proper type definition and required fields.
35-35
: LGTM: Valid JSON Schema reference.The schema correctly references the JSON Schema standard.
class_generator/schema/triggertemplatelist.json (3)
1-6
: LGTM: Basic schema structure is well-defined.The schema correctly defines a list type with required fields following Kubernetes conventions.
28-34
: LGTM: Kubernetes GVK metadata is correct.The x-kubernetes-group-version-kind metadata correctly specifies the Tekton Triggers API group, version, and kind.
7-27
: Verify external schema references.The schema references external definitions that need to be verified:
_definitions.json#/definitions/dev.tekton.triggers.v1beta1.TriggerTemplate
_definitions.json#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta
class_generator/schema/verificationpolicylist.json (2)
1-6
: LGTM: Basic structure follows Kubernetes conventionsThe schema correctly defines a Kubernetes list type with proper type definition and required fields.
28-36
: Note: This is an alpha API versionThe schema defines a Tekton API in
v1alpha1
version, which indicates it's in alpha status. This means:
- The API may change incompatibly in future releases
- It may be buggy and is not recommended for production use
#!/bin/bash # Description: Check if there are any newer versions of this API # Test: Look for any other versions of VerificationPolicy in the schema directory echo "Checking for other API versions..." fd "verificationpolicylist.*\.json" class_generator/schema/ --exec grep -l "tekton.dev"class_generator/schema/resolutionrequestlist.json (3)
7-27
: LGTM! Properties are well-defined and documented.The properties section follows Kubernetes API conventions and includes proper documentation links.
35-36
: LGTM! Schema version is correctly specified.The JSON Schema version is properly declared.
28-34
: Verify GVK consistency with referenced definition.The group-version-kind information needs to match the referenced ResolutionRequest definition.
class_generator/schema/clusterinterceptorlist.json (4)
1-6
: LGTM: Basic schema structure follows Kubernetes conventionsThe schema correctly defines a list type with proper type definition and required fields.
28-34
: LGTM: Kubernetes GVK metadata is properly definedThe x-kubernetes-group-version-kind metadata correctly specifies this as a Tekton triggers v1alpha1 resource.
35-36
: LGTM: Schema version is properly specifiedThe JSON Schema version is correctly defined and the document is properly formatted.
7-27
: Verify the referenced ClusterInterceptor definitionThe schema correctly defines all required Kubernetes list type properties. However, let's verify the referenced ClusterInterceptor definition exists.
✅ Verification successful
Schema references are properly defined and linked
The verification confirms that:
- The standalone
clusterinterceptor.json
schema exists and properly defines the ClusterInterceptor kind- The schema follows Kubernetes API conventions with correct group, version, and kind
- The list schema in
clusterinterceptorlist.json
correctly references this definition🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the referenced ClusterInterceptor definition exists # Expected: Find the referenced definition file and verify it contains the ClusterInterceptor type # Check if the definitions file exists and contains the referenced type rg -l "dev\.tekton\.triggers\.v1alpha1\.ClusterInterceptor" class_generator/schema/_definitions.json # Also check for a standalone ClusterInterceptor schema file fd "clusterinterceptor.json" class_generator/schema/Length of output: 202
Script:
#!/bin/bash # Let's verify the content of _definitions.json and clusterinterceptor.json to ensure proper references # Check the content of _definitions.json for ClusterInterceptor definition rg "dev\.tekton\.triggers\.v1alpha1\.ClusterInterceptor" -A 5 class_generator/schema/_definitions.json # Check the content of clusterinterceptor.json for schema structure cat class_generator/schema/clusterinterceptor.jsonLength of output: 385
class_generator/schema/manualapprovalgatelist.json (3)
1-7
: LGTM: Basic schema structure is well-definedThe schema follows JSON Schema standards with proper type definition and required fields.
23-26
: LGTM: Standard Kubernetes list metadataThe metadata field correctly references the standard Kubernetes ListMeta type.
28-34
: Note: Alpha API versionThe resource is using an alpha API version (
v1alpha1
). Be aware that the API may change in future versions without backward compatibility guarantees.✅ Verification successful
Note: Alpha API version is expected
The API version
v1alpha1
forManualApprovalGate
is consistent with other Tekton operator resources in the codebase. All Tekton operator resources (TektonConfig, TektonPipeline, TektonChain, etc.) are using the samev1alpha1
version, indicating this is the intended API version for the operator's resources.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check if there are any other versions of this API echo "Checking for other versions of the API..." rg -g "*.json" "operator\.tekton\.dev.*ManualApprovalGate" class_generator/schema/Length of output: 272
Script:
#!/bin/bash # Let's try a more comprehensive search for ManualApprovalGate related files and versions echo "Searching for ManualApprovalGate in JSON files..." find class_generator/schema -type f -name "*.json" -exec grep -l "ManualApprovalGate" {} \; echo -e "\nChecking content of found files..." find class_generator/schema -type f -name "*.json" -exec sh -c 'echo "=== $1 ==="; cat "$1" | grep -A 2 -B 2 "version.*alpha"' sh {} \; echo -e "\nSearching for any other version patterns..." rg "operator\.tekton\.dev" class_generator/schema/Length of output: 187310
class_generator/schema/tektoninstallersetlist.json (4)
1-6
: LGTM: Basic schema structure is well-defined.The schema correctly defines the basic structure for a Kubernetes list type with appropriate required fields.
35-36
: LGTM: Schema validation is properly configured.The JSON Schema version is correctly specified.
7-27
: Verify external schema references.The schema structure looks good, but let's verify the existence and correctness of the referenced definitions.
28-34
: Note: This is an alpha API version.The schema is correctly configured with group-version-kind information, but be aware that
v1alpha1
indicates this API is not yet stable and may change in future releases.✅ Verification successful
Note: This API is in alpha state (v1alpha1)
The TektonInstallerSet API appears to only exist in v1alpha1 version, with no stable versions (v1 or v1beta1) found in the codebase. As noted in the original review, this indicates the API is not yet stable and may undergo changes in future releases.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for other versions of this API echo "Checking for other versions of TektonInstallerSetList..." rg -l "operator\.tekton\.dev.*TektonInstallerSetList" class_generator/schema/Length of output: 202
Script:
#!/bin/bash # Let's try a broader search to find all tekton installer related files and their versions echo "Searching for tekton installer related files..." fd -t f . class_generator/schema/ -x cat {} | grep -i "tektoninstaller" echo -e "\nSearching for any v1alpha1 APIs in the schema directory..." fd -t f . class_generator/schema/ -x cat {} | grep -A 2 -B 2 "v1alpha1"Length of output: 165664
Script:
#!/bin/bash # Let's check if there are any stable versions (v1, v1beta1) of TektonInstallerSet echo "Searching for other versions of TektonInstallerSet..." rg -l "operator\.tekton\.dev.*TektonInstallerSet" --type json echo -e "\nChecking specific TektonInstallerSet version references..." rg "operator\.tekton\.dev.*TektonInstallerSet.*v\d" --type jsonLength of output: 379
class_generator/schema/clustertriggerbindinglist.json (4)
1-6
: LGTM! Basic schema structure is well-defined.The schema correctly defines a list type with proper description and required fields.
35-36
: LGTM! Schema validation is properly configured.The schema correctly references the JSON Schema standard.
28-34
: Monitor for stable API version availability.The schema currently uses
v1beta1
version. Consider tracking when this API moves to GA (v1) as beta versions may have breaking changes.✅ Verification successful
Let me try a different approach to verify the API version status.
This will help us understand:
- All occurrences of ClusterTriggerBinding and their versions
- Any documentation mentioning version changes or stability status
Let me try one final verification to check the Tekton API documentation references.
Let me check the versions across all trigger-related resources for a complete picture.
API version status is consistent with the ecosystem
The
v1beta1
version for ClusterTriggerBinding is consistent with other Tekton Triggers resources. Most trigger-related resources (TriggerTemplate, TriggerBinding, EventListener) are atv1beta1
, while only Interceptor-related resources are atv1alpha1
. This indicates the API version is at the current stable beta release across the Tekton Triggers ecosystem.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check if there are any v1 versions of this API already available # Search for any v1 versions of ClusterTriggerBinding in schema directory fd -t f "clustertriggerbinding.*json" "$(dirname class_generator/schema/clustertriggerbindinglist.json)" -x grep -l '"version": "v1"' {}Length of output: 161
Script:
#!/bin/bash # Search for all versions of ClusterTriggerBinding in schema files rg -A 2 -B 2 "ClusterTriggerBinding" class_generator/schema/ --json | jq -r 'select(.type=="match") | .data.lines.text' # Also check any potential documentation or README files fd -t f "README|CHANGELOG" -x grep -i "clustertriggerbinding" {}Length of output: 452
Script:
#!/bin/bash # Search for any references to API versions in the schema definitions rg -A 5 "tekton.triggers" class_generator/schema/_definitions.json # Also check if there are any other trigger-related resources that might indicate version patterns rg -l "triggers.tekton.dev" class_generator/schema/Length of output: 750
Script:
#!/bin/bash # Check versions across all Tekton trigger resources for file in $(rg -l "triggers.tekton.dev" class_generator/schema/); do echo "=== $file ===" rg '"version":' "$file" -A 1 doneLength of output: 4052
7-27
: Verify referenced schema definitions exist.The schema references external definitions that need to be present for proper functionality:
_definitions.json#/definitions/dev.tekton.triggers.v1beta1.ClusterTriggerBinding
_definitions.json#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.ListMeta
class_generator/class_generator.py (5)
10-11
: LGTM: New imports are correctly placed and necessary.The added imports support version comparison (
Version
) and file operations (shutil
), which are used in the enhanced version management and schema update functionality.
41-43
: LGTM: Function signature improvement enhances clarity.The updated signature makes the function's requirements more explicit by adding dedicated parameters for
kind
,group
, andversion
, improving code readability and maintainability.
198-210
: LGTM: Version management logic is well-implemented.The implementation correctly:
- Stores the cluster version in a temporary file
- Compares versions using the
packaging.version.Version
class- Updates the version file only when a newer version is detected
214-229
: LGTM: Schema directory handling is robust and efficient.The implementation correctly:
- Uses a temporary directory for new schemas
- Copies all files when the version is newer
- Only copies new files when the version is the same or older
519-519
: LGTM: Robust handling of missing properties field.The use of
get()
with a default empty dictionary ensures graceful handling when a resource schema lacks theproperties
field, directly addressing the PR's main objective.
…nto classg-fix-when-kind-without-properties
/verified |
…nto classg-fix-when-kind-without-properties
/verified |
…nto classg-fix-when-kind-without-properties
/verified |
…nto classg-fix-when-kind-without-properties
/verified |
properties
in the schema.Summary by CodeRabbit
New Features
.coderabbit.yaml
to manage project settings, review processes, and tool integrations.Bug Fixes
Chores
.gitignore
to include new entries for ignored files and directories, streamlining version control.