Skip to content

Conversation

@grokspawn
Copy link
Contributor

Description of the change:
Various type changes and refactoring necessary to make opm alpha render-template capable 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 3b16530 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.

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

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Docs updated or added to /docs
  • Commit messages sensible and descriptive

Assisted-by: Claude

@grokspawn grokspawn requested a review from Copilot October 17, 2025 21:07
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 17, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign tmshort for approval. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 17, 2025
Copy link

Copilot AI left a 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-template command that supports both explicit type specification and automatic schema-based detection
  • Introduced Template interface 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.

@grokspawn grokspawn changed the title Autodetected template Autodetected template in opm alpha render-template Oct 17, 2025
@grokspawn grokspawn force-pushed the autodetected-template branch from 3b16530 to d4baa2f Compare October 17, 2025 21:25
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 17, 2025
@codecov
Copy link

codecov bot commented Oct 17, 2025

Codecov Report

❌ Patch coverage is 53.05344% with 123 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.37%. Comparing base (24737fb) to head (d4baa2f).

Files with missing lines Patch % Lines
alpha/template/basic/basic.go 0.00% 30 Missing ⚠️
alpha/template/substitutes/substitutes.go 78.07% 20 Missing and 5 partials ⚠️
alpha/template/template.go 0.00% 24 Missing ⚠️
alpha/template/schema.go 0.00% 19 Missing ⚠️
alpha/template/semver/semver.go 44.00% 14 Missing ⚠️
alpha/model/model.go 78.94% 8 Missing ⚠️
alpha/declcfg/declcfg_to_model.go 70.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master    #1814    +/-   ##
========================================
  Coverage   55.37%   55.37%            
========================================
  Files         136      138     +2     
  Lines       16003    16227   +224     
========================================
+ Hits         8861     8986   +125     
- Misses       5987     6079    +92     
- Partials     1155     1162     +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@operator-framework operator-framework deleted a comment from Copilot AI Oct 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants