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

class-generator: fix when kind do not have properties #2181

Merged
merged 20 commits into from
Oct 31, 2024

Conversation

myakove
Copy link
Collaborator

@myakove myakove commented Oct 27, 2024

  1. Do not fail when the resource does not have properties in the schema.
  2. Do not overwrite existing files when the schema is generated with older cluster versions.

Summary by CodeRabbit

  • New Features

    • Enhanced version management for schema generation, including tracking of the last generated cluster version.
    • Expanded list of supported Kubernetes and OpenShift resource types, including new entries for various components and services.
    • Introduced new JSON schema definitions for multiple resources within the Tekton and OpenShift Pipelines frameworks.
    • New configuration file .coderabbit.yaml to manage project settings, review processes, and tool integrations.
  • Bug Fixes

    • Improved handling of schema properties to prevent errors when expected structures are missing.
  • Chores

    • Updated .gitignore to include new entries for ignored files and directories, streamlining version control.
    • Added a new version identifier for the cluster component.

Copy link

coderabbitai bot commented Oct 27, 2024

Walkthrough

The pull request introduces changes across multiple files, primarily focusing on updates to the .gitignore, versioning, and schema definitions. The .gitignore file now includes an entry for .envrc while removing the entry for class_generator/__ocp-openapi.json. A new version identifier v1.31.0 is added to __cluster_version__.txt. The class_generator/class_generator.py file sees enhancements in version management and schema updates, including changes to file paths and logic for generating OpenAPI JSON files. Additionally, many new types are added to __not-kind.txt.

Changes

File Path Change Summary
.gitignore Added entry: .envrc; removed entry: class_generator/__ocp-openapi.json.
class_generator/__cluster_version__.txt Added version identifier: v1.31.0.
class_generator/class_generator.py Added imports and variables for version management; modified logic for OpenAPI JSON generation and schema updates.
class_generator/schema/__not-kind.txt Added multiple new types related to Kubernetes and OpenShift components.
class_generator/schema/clusterinterceptor.json New schema added for ClusterInterceptor.
class_generator/schema/clusterinterceptorlist.json New schema added for ClusterInterceptorList.
class_generator/schema/clustertask.json New schema added for ClusterTask.
class_generator/schema/clustertasklist.json New schema added for ClusterTaskList.
class_generator/schema/clustertriggerbinding.json New schema added for ClusterTriggerBinding.
class_generator/schema/clustertriggerbindinglist.json New schema added for ClusterTriggerBindingList.
class_generator/schema/customrun.json New schema added for CustomRun.
class_generator/schema/customrunlist.json New schema added for CustomRunList.
class_generator/schema/eventlistener.json New schema added for EventListener.
class_generator/schema/eventlistenerlist.json New schema added for EventListenerList.
class_generator/schema/interceptor.json New schema added for Interceptor.
class_generator/schema/interceptorlist.json New schema added for InterceptorList.
class_generator/schema/manualapprovalgate.json New schema added for ManualApprovalGate.
class_generator/schema/manualapprovalgatelist.json New schema added for ManualApprovalGateList.
class_generator/schema/openshiftpipelinesascode.json New schema added for OpenShiftPipelinesAsCode.
class_generator/schema/openshiftpipelinesascodelist.json New schema added for OpenShiftPipelinesAsCodeList.
class_generator/schema/pipeline.json New schema added for Pipeline.
class_generator/schema/pipelinelist.json New schema added for PipelineList.
class_generator/schema/pipelinerun.json New schema added for PipelineRun.
class_generator/schema/pipelinerunlist.json New schema added for PipelineRunList.
class_generator/schema/repository.json New schema added for Repository.
class_generator/schema/repositorylist.json New schema added for RepositoryList.
class_generator/schema/resolutionrequest.json New schema added for ResolutionRequest.
class_generator/schema/resolutionrequestlist.json New schema added for ResolutionRequestList.
class_generator/schema/stepaction.json New schema added for StepAction.
class_generator/schema/stepactionlist.json New schema added for StepActionList.
class_generator/schema/task.json New schema added for Task.
class_generator/schema/tasklist.json New schema added for TaskList.
class_generator/schema/taskrun.json New schema added for TaskRun.
class_generator/schema/taskrunlist.json New schema added for TaskRunList.
class_generator/schema/tektonaddon.json New schema added for TektonAddon.
class_generator/schema/tektonaddonlist.json New schema added for TektonAddonList.
class_generator/schema/tektonchain.json New schema added for TektonChain.
class_generator/schema/tektonchainlist.json New schema added for TektonChainList.
class_generator/schema/tektonconfig.json New schema added for TektonConfig.
class_generator/schema/tektonconfiglist.json New schema added for TektonConfigList.
class_generator/schema/tektonhub.json New schema added for TektonHub.
class_generator/schema/tektonhublist.json New schema added for TektonHubList.
class_generator/schema/tektoninstallerset.json New schema added for TektonInstallerSet.
class_generator/schema/tektoninstallersetlist.json New schema added for TektonInstallerSetList.
class_generator/schema/tektonpipeline.json New schema added for TektonPipeline.
class_generator/schema/tektonpipelinelist.json New schema added for TektonPipelineList.
class_generator/schema/tektonresult.json New schema added for TektonResult.
class_generator/schema/tektonresultlist.json New schema added for TektonResultList.
class_generator/schema/tektontrigger.json New schema added for TektonTrigger.
class_generator/schema/tektontriggerlist.json New schema added for TektonTriggerList.
class_generator/schema/trigger.json New schema added for Kubernetes Trigger resource.
class_generator/schema/triggerbinding.json New schema added for TriggerBinding.
class_generator/schema/triggerbindinglist.json New schema added for TriggerBindingList.
class_generator/schema/triggerlist.json New schema added for TriggerList.
class_generator/schema/triggertemplate.json New schema added for TriggerTemplate.
class_generator/schema/triggertemplatelist.json New schema added for TriggerTemplateList.
class_generator/schema/verificationpolicy.json New schema added for VerificationPolicy.
class_generator/schema/verificationpolicylist.json New schema added for VerificationPolicyList.
class_generator/tests/manifests/Pipeline/pipeline.py New class Pipeline added.
class_generator/tests/test_class_generator.py Updated parameterization of test_parse_explain function to modify kind values.
.coderabbit.yaml New configuration file with settings for language, review processes, tool integrations, and chat functionalities.

Possibly related PRs

Suggested labels

size/S, can-be-merged, approved-rnetser, commented-coderabbitai[bot]

Suggested reviewers

  • dbasunag
  • omrirh
  • rnetser

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@redhat-qe-bot1
Copy link

Report bugs in Issues

The following are automatically added:

  • Add reviewers from OWNER file (in the root of the repository) under reviewers section.
  • Set PR size label.
  • New issue is created for the PR. (Closed when PR is merged/closed)
  • Run pre-commit if .pre-commit-config.yaml exists in the repo.

Available user actions:

  • To mark PR as WIP comment /wip to the PR, To remove it from the PR comment /wip cancel to the PR.
  • To block merging of PR comment /hold, To un-block merging of PR comment /hold cancel.
  • To mark PR as verified comment /verified to the PR, to un-verify comment /verified cancel to the PR.
    verified label removed on each new commit push.
  • To cherry pick a merged PR comment /cherry-pick <target branch to cherry-pick to> in the PR.
    • Multiple target branches can be cherry-picked, separated by spaces. (/cherry-pick branch1 branch2)
    • Cherry-pick will be started when PR is merged
  • To build and push container image command /build-and-push-container in the PR (tag will be the PR number).
    • You can add extra args to the Podman build command
      • Example: /build-and-push-container --build-arg OPENSHIFT_PYTHON_WRAPPER_COMMIT=<commit_hash>
  • To add a label by comment use /<label name>, to remove, use /<label name> cancel
  • To assign reviewers based on OWNERS file use /assign-reviewers
  • To check if PR can be merged use /check-can-merge
Supported /retest check runs
  • /retest tox: Retest tox
  • /retest python-module-install: Retest python-module-install
  • /retest all: Retest all
Supported labels
  • hold
  • verified
  • wip
  • lgtm

Copy link

@coderabbitai coderabbitai bot left a 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

📥 Commits

Files that changed from the base of the PR and between cc553f1 and 43025c7.

⛔ 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:

  1. All List types have their corresponding singular types included
  2. The new entries follow the same pattern as existing entries
  3. 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
done

Length 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 1

Length of output: 30221

class_generator/class_generator.py (2)

10-11: Import necessary modules for version comparison and file operations

The addition of Version from packaging.version and shutil 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 value

Using get("properties", {}) ensures that schema_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 potential KeyError exceptions.

class_generator/class_generator.py Outdated Show resolved Hide resolved
class_generator/class_generator.py Outdated Show resolved Hide resolved
class_generator/class_generator.py Outdated Show resolved Hide resolved
@myakove
Copy link
Collaborator Author

myakove commented Oct 27, 2024

/verified

@myakove
Copy link
Collaborator Author

myakove commented Oct 27, 2024

/verified cancel

Copy link

@coderabbitai coderabbitai bot left a 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 declaration

The 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:

  1. Document the schema evolution strategy for future versions
  2. Consider implementing schema version validation in the class generator
  3. 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 version

While 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 version

The 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 documentation

While 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

📥 Commits

Files that changed from the base of the PR and between 43025c7 and 21c7bd7.

📒 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:

  1. All non-list Tekton resources (TektonTrigger, TektonAddon, TektonChain, etc.) have the same minimal schema structure
  2. The list-type resources (TektonTriggerList, TektonAddonList, etc.) have complete schemas with properties
  3. 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
done

Length 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.json

Length 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
fi

Length 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 in tektoninstallerset.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.json

Length 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.json

Length 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*.json

Length 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-defined

The schema correctly defines the basic structure for a Kubernetes list type with appropriate required fields.


28-34: Note: Using beta version API

The 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 no v1 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 and TektonAddonList
🏁 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-defined

The schema correctly defines TektonChainList as an object type with appropriate required fields.


28-34: LGTM: Kubernetes metadata is correctly defined

The 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-defined

The 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 conventions

The schema correctly defines a Kubernetes list type with proper type definition and required fields.


28-36: Note: This is an alpha API version

The 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 conventions

The schema correctly defines a list type with proper type definition and required fields.


28-34: LGTM: Kubernetes GVK metadata is properly defined

The x-kubernetes-group-version-kind metadata correctly specifies this as a Tekton triggers v1alpha1 resource.


35-36: LGTM: Schema version is properly specified

The JSON Schema version is correctly defined and the document is properly formatted.


7-27: Verify the referenced ClusterInterceptor definition

The 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.json

Length of output: 385

class_generator/schema/manualapprovalgatelist.json (3)

1-7: LGTM: Basic schema structure is well-defined

The schema follows JSON Schema standards with proper type definition and required fields.


23-26: LGTM: Standard Kubernetes list metadata

The metadata field correctly references the standard Kubernetes ListMeta type.


28-34: Note: Alpha API version

The 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 for ManualApprovalGate is consistent with other Tekton operator resources in the codebase. All Tekton operator resources (TektonConfig, TektonPipeline, TektonChain, etc.) are using the same v1alpha1 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 json

Length 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:

  1. All occurrences of ClusterTriggerBinding and their versions
  2. 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 at v1beta1, while only Interceptor-related resources are at v1alpha1. 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
done

Length of output: 4052


7-27: Verify referenced schema definitions exist.

The schema references external definitions that need to be present for proper functionality:

  1. _definitions.json#/definitions/dev.tekton.triggers.v1beta1.ClusterTriggerBinding
  2. _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, and version, improving code readability and maintainability.


198-210: LGTM: Version management logic is well-implemented.

The implementation correctly:

  1. Stores the cluster version in a temporary file
  2. Compares versions using the packaging.version.Version class
  3. Updates the version file only when a newer version is detected

214-229: LGTM: Schema directory handling is robust and efficient.

The implementation correctly:

  1. Uses a temporary directory for new schemas
  2. Copies all files when the version is newer
  3. 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 the properties field, directly addressing the PR's main objective.

class_generator/schema/tektontrigger.json Show resolved Hide resolved
class_generator/schema/tasklist.json Show resolved Hide resolved
class_generator/schema/taskrunlist.json Show resolved Hide resolved
class_generator/schema/pipelinelist.json Show resolved Hide resolved
@myakove
Copy link
Collaborator Author

myakove commented Oct 28, 2024

/verified

@myakove
Copy link
Collaborator Author

myakove commented Oct 28, 2024

/verified

@myakove
Copy link
Collaborator Author

myakove commented Oct 29, 2024

/verified

@myakove myakove disabled auto-merge October 29, 2024 07:32
@rh-bot-1 rh-bot-1 removed the verified label Oct 31, 2024
@myakove
Copy link
Collaborator Author

myakove commented Oct 31, 2024

/verified

@myakove myakove merged commit c955efc into main Oct 31, 2024
5 of 6 checks passed
@myakove myakove deleted the classg-fix-when-kind-without-properties branch October 31, 2024 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants