chartify
chartify copied to clipboard
Add ability to pass extra arguments to kustomize build command
This PR adds support for passing extra arguments to the kustomize build command, which is needed for kustomize plugins like ksops that require additional flags such as --enable-exec.
Changes Made
Core Implementation
-
Added
ExtraArgs []stringfield toKustomizeBuildOptsstruct - allows passing extra arguments to kustomize build operations -
Added
KustomizeBuildArgs []stringfield toChartifyOptsstruct - exposes the functionality at the main API level -
Added
ExtraArgs []stringfield toPatchOptsstruct - ensures consistent support across all kustomize operations - Modified kustomize build command construction - extra arguments are appended to the command after standard flags
CLI Support
-
Added
--kustomize-build-argflag - can be specified multiple times to pass extra arguments - Updated help documentation - includes usage examples for the new flag
Testing
- Added comprehensive unit tests - verify field initialization and argument handling
- Verified end-to-end functionality - tested CLI with real kustomize operations
Usage Examples
Single extra argument
chartify --kustomize-build-arg="--enable-exec" release-name /path/to/kustomization
Multiple extra arguments
chartify --kustomize-build-arg="--enable-exec" --kustomize-build-arg="--verbose" release-name /path/to/kustomization
Programmatic usage
opts := &chartify.ChartifyOpts{
KustomizeBuildArgs: []string{"--enable-exec", "--some-other-flag"},
}
Implementation Details
The extra arguments are appended to the kustomize build command after all standard flags:
kustomize build --load-restrictor=LoadRestrictionsNone --enable-helm --helm-command=helm --enable-exec /path/to/build
This approach ensures compatibility with existing functionality while providing the flexibility needed for kustomize plugins.
Fixes #113.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.