Skip to content

feat: add support for --set-file flag#319

Merged
manusa merged 1 commit intomanusa:mainfrom
afalhambra-hivemq:feat/set-file
Feb 7, 2026
Merged

feat: add support for --set-file flag#319
manusa merged 1 commit intomanusa:mainfrom
afalhambra-hivemq:feat/set-file

Conversation

@afalhambra-hivemq
Copy link
Contributor

@afalhambra-hivemq afalhambra-hivemq commented Dec 1, 2025

Closes #318

Summary

This PR adds support for Helm's --set-file flag to the Java client, allowing users to set chart values by reading contents from files.

Changes

  • Added setFile(String key, Path file) method to InstallCommand, UpgradeCommand, and TemplateCommand
  • Implemented support across all layers:
    • Go native layer (InstallOptions, UpgradeOptions, TemplateOptions with SetFiles field)
    • C bindings (FFI layer with setFiles field)
    • JNA bridge layer (InstallOptions.java, UpgradeOptions.java, TemplateOptions.java)
    • Java API layer (InstallCommand.java, UpgradeCommand.java, TemplateCommand.java)
  • Refactored URL encoding into a generic method using Function<T, String> mapper
  • Added tests for the new functionality

Usage Example

Path configFile = Paths.get("/path/to/config.yaml");
Path scriptFile = Paths.get("/path/to/script.sh");

// Install with file values
Helm.install("my-chart")
  .withName("my-release")
  .setFile("config", configFile)
  .setFile("script", scriptFile)
  .call();

// Upgrade with file values
Helm.upgrade("my-chart")
  .withName("my-release")
  .setFile("config", configFile)
  .call();

// Template with file values
String manifests = Helm.template("my-chart")
  .setFile("config", configFile)
  .call();

Testing

  • Added tests in HelmInstallTest, HelmTemplateTest, and HelmKubernetesTest
  • All existing tests pass
  • Native libraries rebuilt with updated struct definitions

@afalhambra-hivemq
Copy link
Contributor Author

@manusa - would be so kind to have a look at this PR. Thanks!

Copy link
Owner

@manusa manusa left a comment

Choose a reason for hiding this comment

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

LGTM, thx!

@manusa manusa merged commit b21ec86 into manusa:main Feb 7, 2026
3 checks passed
manusa added a commit that referenced this pull request Feb 7, 2026
Follow-up to #319 addressing code review feedback:
- Revert urlEncode to original non-generic signature
- Add toStringValues helper for Map<String, Path> conversion
- Rename setFiles to fileValues to match Helm SDK naming
- Improve setFile JavaDoc to reference --set-file flag
- Add negative test cases for non-existent file paths
- Document setFile in README for install, template, and upgrade

Signed-off-by: Marc Nuri <marc@marcnuri.com>
manusa added a commit that referenced this pull request Feb 7, 2026
Follow-up to #319 addressing code review feedback:
- Revert urlEncode to original non-generic signature
- Add toStringValues helper for Map<String, Path> conversion
- Rename setFiles to fileValues to match Helm SDK naming
- Improve setFile JavaDoc to reference --set-file flag
- Add negative test cases for non-existent file paths
- Document setFile in README for install, template, and upgrade

Signed-off-by: Marc Nuri <marc@marcnuri.com>
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.

Add support for --set-file flag in install, upgrade, and template commands

2 participants