You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: support @ prefix for object parameters from files
Enable users to load object-type parameters from JSON files using
the @ prefix syntax, similar to curl and kubectl. This provides a
convenient way to pass complex configuration objects without inline
JSON strings.
Usage:
porter install --param config=@/path/to/config.json
porter install --param config='{"key": "value"}'
Parameter sets also support @ prefix:
parameters:
- name: config
source:
value: @/path/to/config.json
Security considerations:
- Only applies to user-provided values (CLI flags/parameter sets)
- Does NOT work with default values in bundle definitions
- Validates JSON structure before processing
- Clear error messages for missing files or invalid JSON
Changes:
- Add @ prefix detection in getUnconvertedValueFromRaw()
- Read and validate JSON file contents for object parameters
- Add comprehensive unit tests covering success/error cases
- Add test fixtures for valid/invalid JSON scenarios
Signed-off-by: Kim Christensen <[email protected]>
* test: add integration tests for object parameter files
Add comprehensive integration tests for object-type parameters
loaded from files using the @ prefix syntax. Tests cover:
- CLI parameter with @ prefix reading from file
- Inline JSON parameter without @ prefix
- Parameter set with @ prefix
- Error handling for missing files
- Error handling for invalid JSON files
Also adds test bundle that uses template syntax to access
object parameter fields in bundle execution steps.
Signed-off-by: Kim <[email protected]>
Signed-off-by: Kim Christensen <[email protected]>
* docs: add documentation for @ prefix file loading
Update CLI help text and user documentation to describe the
@ prefix syntax for loading object parameters from JSON files.
Changes include:
- Updated --param flag help text with @ prefix example
- Added @ prefix examples to install/upgrade/invoke commands
- Added "Object Parameters from Files" section to intro docs
- Updated quickstart guide with @ prefix usage
- Enhanced parameter set file format documentation
- Added example of @ prefix in parameter set YAML
The documentation emphasizes the security constraint that
@ prefix only works for user-provided values, not defaults.
Signed-off-by: Kim <[email protected]>
Signed-off-by: Kim Christensen <[email protected]>
* docs: Update generated documentation files
Signed-off-by: Kim Christensen <[email protected]>
* docs: use path source in parameter sets for file loading
Update documentation to describe the proper `path` source syntax
for parameter set definitions instead of the `@` prefix.
Changes:
- Clarify that `@` prefix is only for CLI --param flags
- Add comprehensive examples showing `path` source in both YAML
and JSON format for parameter set definitions
- Update parameter set example to use schemaVersion 1.1.0
- Remove incorrect documentation about `@` prefix in value sources
- Distinguish between CLI usage (@Prefix) and parameter set usage
(path source)
The `path` source is the correct way to reference files in parameter
set definitions, while the `@` prefix remains a convenient shortcut
for command-line parameter overrides.
Signed-off-by: Kim Christensen <[email protected]>
* ci: add object_param_test to integration test workflows
Signed-off-by: Kim Christensen <[email protected]>
---------
Signed-off-by: Kim Christensen <[email protected]>
Signed-off-by: Kim <[email protected]>
"Parameter sets to use when running the bundle. It should be a named set of parameters and may be specified multiple times.")
429
432
f.StringArrayVar(&opts.Params, "param", nil,
430
-
"Define an individual parameter in the form NAME=VALUE. Overrides parameters otherwise set via --parameter-set. May be specified multiple times.")
433
+
"Define an individual parameter in the form NAME=VALUE. Overrides parameters otherwise set via --parameter-set. May be specified multiple times. For object parameters, use @FILEPATH to load JSON from a file (e.g., --param [email protected]).")
--mount-host-volume stringArray Mount a host volume into the bundle. Format is <host path>:<container path>[:<option>]. May be specified multiple times. Option can be ro (read-only), rw (read-write), default is ro.
60
61
-n, --namespace string Create the installation in the specified namespace. Defaults to the global namespace.
61
62
--no-logs Do not persist the bundle execution logs
62
-
--param stringArray Define an individual parameter in the form NAME=VALUE. Overrides parameters otherwise set via --parameter-set. May be specified multiple times.
63
+
--param stringArray Define an individual parameter in the form NAME=VALUE. Overrides parameters otherwise set via --parameter-set. May be specified multiple times. For object parameters, use @FILEPATH to load JSON from a file (e.g., --param [email protected]).
63
64
-p, --parameter-set stringArray Parameter sets to use when running the bundle. It should be a named set of parameters and may be specified multiple times.
64
65
-r, --reference string Use a bundle in an OCI registry specified by the given reference.
65
66
--verify-bundle Verify the bundle signature before executing
--mount-host-volume stringArray Mount a host volume into the bundle. Format is <host path>:<container path>[:<option>]. May be specified multiple times. Option can be ro (read-only), rw (read-write), default is ro.
60
61
-n, --namespace string Create the installation in the specified namespace. Defaults to the global namespace.
61
62
--no-logs Do not persist the bundle execution logs
62
-
--param stringArray Define an individual parameter in the form NAME=VALUE. Overrides parameters otherwise set via --parameter-set. May be specified multiple times.
63
+
--param stringArray Define an individual parameter in the form NAME=VALUE. Overrides parameters otherwise set via --parameter-set. May be specified multiple times. For object parameters, use @FILEPATH to load JSON from a file (e.g., --param [email protected]).
63
64
-p, --parameter-set stringArray Parameter sets to use when running the bundle. It should be a named set of parameters and may be specified multiple times.
64
65
-r, --reference string Use a bundle in an OCI registry specified by the given reference.
65
66
--verify-bundle Verify the bundle signature before executing
--mount-host-volume stringArray Mount a host volume into the bundle. Format is <host path>:<container path>[:<option>]. May be specified multiple times. Option can be ro (read-only), rw (read-write), default is ro.
57
58
-n, --namespace string Namespace of the specified installation. Defaults to the global namespace.
58
59
--no-logs Do not persist the bundle execution logs
59
-
--param stringArray Define an individual parameter in the form NAME=VALUE. Overrides parameters otherwise set via --parameter-set. May be specified multiple times.
60
+
--param stringArray Define an individual parameter in the form NAME=VALUE. Overrides parameters otherwise set via --parameter-set. May be specified multiple times. For object parameters, use @FILEPATH to load JSON from a file (e.g., --param [email protected]).
60
61
-p, --parameter-set stringArray Parameter sets to use when running the bundle. It should be a named set of parameters and may be specified multiple times.
61
62
-r, --reference string Use a bundle in an OCI registry specified by the given reference.
--mount-host-volume stringArray Mount a host volume into the bundle. Format is <host path>:<container path>[:<option>]. May be specified multiple times. Option can be ro (read-only), rw (read-write), default is ro.
60
60
-n, --namespace string Namespace of the specified installation. Defaults to the global namespace.
61
61
--no-logs Do not persist the bundle execution logs
62
-
--param stringArray Define an individual parameter in the form NAME=VALUE. Overrides parameters otherwise set via --parameter-set. May be specified multiple times.
62
+
--param stringArray Define an individual parameter in the form NAME=VALUE. Overrides parameters otherwise set via --parameter-set. May be specified multiple times. For object parameters, use @FILEPATH to load JSON from a file (e.g., --param [email protected]).
63
63
-p, --parameter-set stringArray Parameter sets to use when running the bundle. It should be a named set of parameters and may be specified multiple times.
64
64
-r, --reference string Use a bundle in an OCI registry specified by the given reference.
--mount-host-volume stringArray Mount a host volume into the bundle. Format is <host path>:<container path>[:<option>]. May be specified multiple times. Option can be ro (read-only), rw (read-write), default is ro.
57
58
-n, --namespace string Namespace of the specified installation. Defaults to the global namespace.
58
59
--no-logs Do not persist the bundle execution logs
59
-
--param stringArray Define an individual parameter in the form NAME=VALUE. Overrides parameters otherwise set via --parameter-set. May be specified multiple times.
60
+
--param stringArray Define an individual parameter in the form NAME=VALUE. Overrides parameters otherwise set via --parameter-set. May be specified multiple times. For object parameters, use @FILEPATH to load JSON from a file (e.g., --param [email protected]).
60
61
-p, --parameter-set stringArray Parameter sets to use when running the bundle. It should be a named set of parameters and may be specified multiple times.
61
62
-r, --reference string Use a bundle in an OCI registry specified by the given reference.
62
63
--version string Version to which the installation should be upgraded. This represents the version of the bundle, which assumes the convention of setting the bundle tag to its version.
0 commit comments