Development Guide

1. Building the Project

./mvnw clean install

2. Module Dependencies

jhelm (parent)
├── jhelm-gotemplate (standalone template engine)
├── jhelm-core (depends on: jhelm-gotemplate)
├── jhelm-kube (depends on: jhelm-core)
└── jhelm-app (depends on: jhelm-core, jhelm-kube)

3. Testing

  • Unit Tests: Each module has comprehensive unit tests.

  • Integration Tests: KpsComparisonTest.java compares output with native Helm.

  • Template Tests: GoTemplateStandardTest.java, TemplateTest.java.

3.1. Testing Guidelines

Always run tests after making code changes to ensure they don’t break existing functionality.
# Run all tests
./mvnw test

# Run tests for specific module
./mvnw test -pl jhelm-core

# Run specific test class
./mvnw test -Dtest=KpsComparisonTest -pl jhelm-core

# Run specific test method
./mvnw test -Dtest=KpsComparisonTest#testSimpleRendering -pl jhelm-core

Before committing changes:

  1. Run relevant tests to verify your changes work

  2. Check that existing tests still pass

  3. Add new tests for new functionality

  4. Fix any test failures before pushing

4. Debugging Tips

  • Enable detailed logging with @Slf4j annotations.

  • Check test_output.txt and jhelm-core/test_output.txt for test results.

  • Use GoTemplateStandardTest to verify template behavior.

  • Compare output with Helm using dry-run tests in KpsComparisonTest.

5. Common Operations

5.1. Adding a new template function

  1. Determine the appropriate category:

    • Helm functions: Use helm/conversion/, helm/template/, helm/kubernetes/, or helm/chart/

    • Sprig functions: Use sprig/strings/, sprig/collections/, sprig/logic/, or create a new category

  2. Add function to the appropriate category class (e.g., StringFunctions.java)

  3. Function will be automatically registered via the coordinator (HelmFunctions or SprigFunctionsRegistry)

  4. Add tests in corresponding test class (e.g., Helm4FunctionsTest.java)

  5. Update getFunctionCategories() in the coordinator if adding a new category