chartify icon indicating copy to clipboard operation
chartify copied to clipboard

Add ability to pass extra arguments to kustomize build command

Open Copilot opened this issue 4 months ago • 0 comments

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 []string field to KustomizeBuildOpts struct - allows passing extra arguments to kustomize build operations
  • Added KustomizeBuildArgs []string field to ChartifyOpts struct - exposes the functionality at the main API level
  • Added ExtraArgs []string field to PatchOpts struct - 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-arg flag - 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.

Copilot avatar Sep 09 '25 23:09 Copilot