[Misc] Enhance template handling during build#103
Conversation
There was a problem hiding this comment.
The PR introduces a meaningful enhancement to template handling, but there are several substantive issues: the missing isConfigurableTemplateChart argument to getHelperTpl is a functional regression for configurable-template charts, the readdir loop doesn't filter out subdirectories, and the double-invocation of generator functions should be addressed for correctness and efficiency. The test suite also needs better isolation to avoid stale gen/ output causing false positives.
PR Bot Information
Version: 1.20.51
- LLM:
anthropic--claude-4.6-sonnet - Event Trigger:
pull_request.opened - File Content Strategy: Full file content
- Correlation ID:
cf9fa3e5-1d1f-4727-81d6-5453242bb5fd
9c21074 to
d4c2ae2
Compare
… add test for user-defined custom templates
…n in CapOperatorBuildPlugin
… improve user-defined template support and logging
…pOperatorBuildPlugin
…uildPlugin and update template handling logic
Co-authored-by: hyperspace-insights[bot] <209611008+hyperspace-insights[bot]@users.noreply.github.com>
…orBuildPlugin and update tests for nested templates
…ervice parameter and determining service status internally
d4c2ae2 to
51c0e1c
Compare
There was a problem hiding this comment.
The PR introduces a meaningful improvement to template handling during cds build, giving developers explicit control over plugin-generated vs. custom templates. The core logic is sound, but there are a few issues worth addressing: chartYaml.name being undefined can silently produce a broken Helm template string ({{ print "undefined" }}), the test isolation around gen directory cleanup is inconsistent, and the handling of directory entries in userTemplatesDir makes implicit assumptions (that known plugin template names are always files) that could cause unexpected behavior in edge cases.
PR Bot Information
Version: 1.20.51
- LLM:
anthropic--claude-4.6-sonnet - Event Trigger:
pull_request.ready_for_review - Correlation ID:
e0ad1280-510b-4272-a732-06097168eaa3 - File Content Strategy: Full file content
Enhance Template Handling During
cds buildNew Feature
✨ Improved the
cds buildprocess to give developers more control over Helm chart templates. Instead of blindly overriding or skipping plugin-generated templates, the build now intelligently handles user-provided templates inchart/templates/:_helpers.tpl,domain.yaml,cap-operator-cros.yaml,service-binding.yaml,service-instance.yaml), the user's version is used and a warning is emitted.chart/templates/not matching known plugin templates are copied alongside the standard templates.build()method for better observability.Changes
lib/build.js: RefactoredcopyTemplates()to usestaticEntry/generatedEntryhelpers modeling each known template. The method now compares user-provided templates against plugin defaults, logs appropriate messages, and copies extra user-defined files. Addedfsmodule for directory reading, and importedgetConfigurableCapOpCroYaml,isConfigurableTemplateChart, andgetProjectFromValuesYamlfromutil.lib/util.js: AddedgetProjectFromValuesYaml()helper function that readsvalues.yamlandChart.yamlto build a normalized project descriptor object, consolidating logic previously scattered acrossbuild.js. Exported the new function.README.md: Added documentation clarifying how custom files inchart/templatesare handled duringcds build, distinguishing between same-name overrides and additional files.test/build.test.js: Added a new test case verifying that custom user-defined templates (including nested subdirectories) are copied into the generated chart while all standard plugin templates are still present. Fixed an existing test: a deleted_helpers.tplin--with-templatesmode now correctly expects the plugin to regenerate it (assertion changed fromfalsetotrue).PR Bot Information
Version:
1.20.51pull_request.editedanthropic--claude-4.6-sonnet0b57b9c5-4336-47bf-9636-77c03d3d45da