WIP: Autodetected template in opm alpha render-template#1814
WIP: Autodetected template in opm alpha render-template#1814grokspawn wants to merge 8 commits intooperator-framework:masterfrom
opm alpha render-template#1814Conversation
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
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@@ Coverage Diff @@
## master #1814 +/- ##
==========================================
- Coverage 57.50% 57.44% -0.06%
==========================================
Files 136 138 +2
Lines 12934 13102 +168
==========================================
+ Hits 7438 7527 +89
- Misses 4341 4413 +72
- Partials 1155 1162 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: grokspawn <jordan@nimblewidget.com>
Signed-off-by: grokspawn <jordan@nimblewidget.com>
Signed-off-by: grokspawn <jordan@nimblewidget.com>
Signed-off-by: grokspawn <jordan@nimblewidget.com>
Signed-off-by: grokspawn <jordan@nimblewidget.com>
Signed-off-by: grokspawn <jordan@nimblewidget.com> Helped-by: Claude-LLM
d4baa2f to
d6531d6
Compare
Signed-off-by: grokspawn <jordan@nimblewidget.com> 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.
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.
|
Didn't anticipate the scope increase in the underlying efforts or the associated complexity challenges. |
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