Skip to content

[Misc] Enhance template handling during build#103

Draft
anirudhprasad-sap wants to merge 8 commits into
mainfrom
enhanceBuildChecks
Draft

[Misc] Enhance template handling during build#103
anirudhprasad-sap wants to merge 8 commits into
mainfrom
enhanceBuildChecks

Conversation

@anirudhprasad-sap
Copy link
Copy Markdown
Contributor

@anirudhprasad-sap anirudhprasad-sap commented May 21, 2026

Enhance Template Handling During Build

New Feature

✨ Improved the cds build process 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 in chart/templates/:

  • If a file with the same name as a plugin-generated template exists (e.g., _helpers.tpl, domain.yaml, cap-operator-cros.yaml, service-binding.yaml, service-instance.yaml), the user's version is used and a warning message is printed indicating the override.
  • If the user's file matches the plugin default, an informational message is logged instead.
  • Any additional/custom files in chart/templates/ that are not known plugin templates are copied alongside the standard templates.
  • A build start message is now emitted at the beginning of the build() method for better observability.

Changes

  • lib/build.js: Refactored copyTemplates() to use staticEntry/generatedEntry helpers that model each known template. The method now compares user-provided templates against plugin defaults, logs appropriate messages, and copies extra user-defined files. Also added getConfigurableCapOpCroYaml and isConfigurableTemplateChart imports, and fs module for directory reading.
  • README.md: Added documentation clarifying how custom files in chart/templates are handled during cds build — distinguishing between same-name overrides and additional files.
  • test/build.test.js: Added a new test case verifying that custom user-defined templates are copied into the generated chart while all standard plugin templates are still present. Updated an existing test: a deleted _helpers.tpl in --with-templates mode now correctly expects the plugin to regenerate it (changed assertion from false to true).
  • 🔄 Regenerate and Update Summary
PR Bot Information

Version: 1.20.51

  • Correlation ID: 62a616a2-736d-49c8-a01d-93e26f565dc9
  • Event Trigger: issue_comment.edited

Copy link
Copy Markdown
Contributor

@hyperspace-insights hyperspace-insights Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread lib/build.js
Comment thread lib/build.js Outdated
Comment thread lib/build.js Outdated
Comment thread lib/build.js Outdated
Comment thread test/build.test.js
Comment thread README.md Outdated
anirudhprasad-sap and others added 2 commits May 21, 2026 14:53
Co-authored-by: hyperspace-insights[bot] <209611008+hyperspace-insights[bot]@users.noreply.github.com>
…orBuildPlugin and update tests for nested templates
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.

copyTemplates() treats chart/templates/ as an all-or-nothing override, silently dropping all SAP-generated templates

1 participant