-
Notifications
You must be signed in to change notification settings - Fork 261
WIP: Autodetected template in opm alpha render-template
#1814
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?
WIP: Autodetected template in opm alpha render-template
#1814
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
Pull Request Overview
This PR introduces template type auto-detection and refactors the template system to use an interface-based factory pattern. The changes enable opm alpha render-template to automatically detect template types from their schema field, standardize naming across all template types, and consolidate command structure.
Key Changes:
- Unified
render-templatecommand that supports both explicit type specification and automatic schema-based detection - Introduced
Templateinterface and factory pattern for creating template instances - Added support for a third template type (substitutes) with release version handling
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
cmd/opm/alpha/template/render.go |
New unified rendering logic supporting both explicit and auto-detected template types |
cmd/opm/alpha/template/cmd.go |
Consolidated command structure accepting optional type and file arguments |
cmd/opm/alpha/template/basic.go |
Removed - functionality moved to package-level template |
cmd/opm/alpha/template/semver.go |
Removed - functionality moved to package-level template |
alpha/template/template.go |
New core interface definitions and registry for template factories |
alpha/template/schema.go |
Schema detection logic for auto-identifying template types |
alpha/template/basic/basic.go |
Refactored to implement Template interface with factory pattern |
alpha/template/semver/semver.go |
Refactored to implement Template interface with factory pattern |
alpha/template/semver/types.go |
Removed - types moved into semver.go |
alpha/template/substitutes/substitutes.go |
New substitutes template implementation |
alpha/property/property.go |
Added Release field to Package property for release versioning |
alpha/model/model.go |
Added release version support and normalized naming for bundles |
alpha/declcfg/declcfg_to_model.go |
Added release version parsing from package properties |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
opm alpha render-template
3b16530 to
d4baa2f
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: grokspawn <[email protected]>
Signed-off-by: grokspawn <[email protected]>
Signed-off-by: grokspawn <[email protected]>
Signed-off-by: grokspawn <[email protected]>
Signed-off-by: grokspawn <[email protected]>
Signed-off-by: grokspawn <[email protected]>
Signed-off-by: grokspawn <[email protected]> Helped-by: Claude-LLM
d4baa2f to
d6531d6
Compare
Signed-off-by: grokspawn <[email protected]> Assisted-by: claude
d6531d6 to
13c696c
Compare
opm alpha render-templateopm alpha render-template
|
|
||
| var tmpl template.Template | ||
|
|
||
| // nolint:nestif |
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.
Reducing the complexity of the else block here seemed not worthwhile, since the code is compact and well-documented, and due to the existing methods being called it introduced more complexity than it resolved.
Description of the change:
Various type changes and refactoring necessary to make
opm alpha render-templatecapable of detecting the template type from sniffing its schema, as well as name standardization across all three template types (did I say THREE? Yes, because this is based on top of #1792), and a new factory-based creation pattern.❗ only commit 13c696c is intended to be part of this activity, but since it's built on not-yet-delivered commits, they are along for the ride for now.
❗marking this WIP, because it is blocked by #1792
Motivation for the change:
Since we created a formal schema for the basic catalog template, it made much more sense for Template to be an interface for a creation/call pattern which was increasingly entrenched in users' tooling... so it was easy to put off. But since it was also largely a "move existing stuff around" activity (read: super simple operations with complex propagation and high potential for side effects), it seemed a great opportunity to see what Claude would do with it.
Reviewer Checklist
/docsAssisted-by: Claude