-
Notifications
You must be signed in to change notification settings - Fork 163
fix: Skip meshery-integration-template model during registry generate #839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Ontiomacer <[email protected]>
|
Yay, your first pull request! 👍 A contributor will be by to give feedback soon. In the meantime, you can find updates in the #github-notifications channel in the community Slack. |
Summary of ChangesHello @Ontiomacer, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an issue where the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request correctly prevents the meshery-integration-template model from being processed during registry generation by adding a skip condition. The change is straightforward and effective. My feedback focuses on improving maintainability by replacing a hardcoded string with a constant.
registry/model.go
Outdated
| if model.Model == "meshery-integration-template"{ | ||
| log.Info("Skipping meshery-integration-template model") | ||
| continue | ||
| } |
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.
The string "meshery-integration-template" is used as a magic string. To improve maintainability and avoid potential typos, it's better to define it as a constant at the package level. This also makes it easier to update if the template name changes in the future.
Please define a constant at the top of the file, for example:
const mesheryIntegrationTemplateModel = "meshery-integration-template"And then use it here.
| if model.Model == "meshery-integration-template"{ | |
| log.Info("Skipping meshery-integration-template model") | |
| continue | |
| } | |
| if model.Model == mesheryIntegrationTemplateModel { | |
| log.Infof("Skipping model: %s", mesheryIntegrationTemplateModel) | |
| continue | |
| } |
Signed-off-by: Ontiomacer <[email protected]>
Signed-off-by: Ontiomacer <[email protected]>
|
@leecalcote This PR resolves meshery/meshery#14702. It adds a constant for meshery-integration-template and ensures this |
|
Any changes or issues with it @leecalcote |
|
attempt to fix meshery/meshery#14702 |
| // Iterate models from the spreadsheet | ||
| for _, model := range modelCSVHelper.Models { | ||
|
|
||
| if model.Model == mesheryIntegrationTemplateModel{ |
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.
👋 @Ontiomacer thanks,
Even if it does the job, the intention is not clear enough, I mean if I am not aware of the open issue I will have the question why do we skip this model, I'd suggest to use a slice with a name that describe the intention to make easier to understand the main purpose. Then, you can check if the model name is inside that slice. Does it make sense ?
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.
There is a "PublishToRegistry" column that should be set to false for this row and just like any other row with a false value for this column, those columns should not be considered for generation.
This column is an ideal flag (built for this purpose).
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.
Thanks @leecalcote and @lekaf974!
Acknowledged — the PublishToRegistry flag is indeed the intended control for excluding template rows.
Since the spreadsheet doesn’t mark this row yet, the skip here prevents generator errors until the flag is updated.
This PR fixes meshery/meshery #14702.
In the Meshery Integrations Spreadsheet, the row
meshery-integration-template is an example/template model used for
creating new model entries. It should not be processed during
mesheryctl registry generate.
This PR adds a simple conditional check inside registry/model.go to
skip this model gracefully, preventing the generator from attempting to
register a template model and avoiding unnecessary errors in the logs.
What I changed :
Ran:
mesheryctl registry generate --directory ./mesheryctl/templates/template-csvs