cub function local
cub function local
Execute a function locally on input data for debugging
Synopsis
Execute a ConfigHub function locally on input data for debugging purposes.
This command allows you to test functions without connecting to the ConfigHub server. It reads configuration data from a file and executes the specified function locally.
The first positional argument must be a filename containing the configuration data. Use "-" to read from stdin.
Function argument values may be simply listed in order so long as no optional parameters are skipped. Parameters may be specified out of order using the "--parameter-name=value" syntax. These are not cub flags, so specify "--" before the filename if using that syntax for function arguments.
Examples:
# Execute set-image function on local file
cub function local deployment.yaml set-image nginx nginx:1.25-alpine --toolchain Kubernetes/YAML
# Execute yq function on local file to extract a field
cub function local config.yaml yq '.spec.replicas' --toolchain Kubernetes/YAML
# Execute function with named parameters
cub function local -- deployment.yaml set-int-path --apiVersion=apps/v1 --kind=Deployment --path=spec.replicas --value=3
# Read from stdin
cat deployment.yaml | cub function local - set-replicas 3 --toolchain Kubernetes/YAML
cub function local <filename> <function> [<arg1> ...] [flags]
Options
--data-only show config data without other response details
-h, --help help for local
--jq string jq expression, suppressing default output
--json JSON output, suppressing default output
--output-jq string apply jq to output JSON
--output-json show output as raw JSON
--output-only show output without other response details
--quiet No default output.
--toolchain string Toolchain type for the function execution (default "Kubernetes/YAML")
--verbose Detailed output, additive with default output
--where-resource string filter which resources the function operates on
--yaml YAML output, suppressing default output
--yq string yq expression, suppressing default output
Options inherited from parent commands
--context string The context to use for this command
--debug Debug output
--executor-space string Space ID or slug whose executor to use for builtin functions (org-level only)
--space string space ID to perform command on
SEE ALSO
- cub function - Function commands