feat: add persistent parameter shorthand#3574
feat: add persistent parameter shorthand#3574kichristensen wants to merge 10 commits intogetporter:mainfrom
Conversation
Add `persistent: true` on a parameter as shorthand for wiring up a matching output so the value is remembered across bundle executions (install → upgrade/uninstall). Requires schema version 1.2.0 and the `persistent-parameters` experimental feature flag. At validation time, a persistent parameter expands to: - path: /cnab/app/<name> - source.output: <name> - applyTo: [install, upgrade, uninstall, ...] - auto-generated matching output definition Closes getporter#1889 Signed-off-by: Kim Christensen <[email protected]>
Add 1.2.0 manifest file format changelog, update version table in _index.md, and expand persisting-data guide with Approach 3 (Persistent Parameters, experimental) listed last. Signed-off-by: Kim Christensen <[email protected]>
Enable FlagPersistentParameters before loading the manifest in Run(), so that expandPersistentParameters() succeeds inside the bundle container without requiring the flag in the container's config. Mirrors the existing SchemaCheck=none pattern. Update golden schema files to include the persistent property in the parameter definition. Signed-off-by: Kim Christensen <[email protected]>
Signed-off-by: Kim Christensen <[email protected]>
Signed-off-by: Kim Christensen <[email protected]>
There was a problem hiding this comment.
Pull request overview
Adds an experimental persistent: true shorthand for manifest parameters that automatically persists install-time values for reuse in later actions (upgrade/uninstall) by expanding into longhand CNAB parameter+output wiring.
Changes:
- Introduces
parameters.persistent(schemaVersion1.2.0, gated bypersistent-parameters) and expands it during manifest validation. - Ensures runtime execution enables the persistent-parameters flag so already-built bundles run without requiring runtime config changes.
- Adds unit/integration tests, schema updates, and documentation for the new shorthand and schema version.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
pkg/manifest/manifest.go |
Expands persistent: true into destination/source/applyTo/output; updates supported schemaVersion constraint based on feature flags. |
pkg/manifest/manifest_test.go |
Unit tests for persistent parameter expansion + schema gating behavior. |
pkg/experimental/experimental.go |
Adds persistent-parameters flag name and FlagPersistentParameters bit. |
pkg/porter/run.go |
Forces persistent-parameters flag on in porter run runtime context. |
pkg/schema/manifest.schema.json |
Adds parameters.persistent to the manifest JSON schema. |
pkg/porter/testdata/schema.json |
Updates embedded test schema to include parameters.persistent. |
tests/integration/testdata/schema/schema.json |
Updates integration schema fixture to include parameters.persistent. |
pkg/manifest/testdata/porter-with-persistent-params.yaml |
New manifest fixture exercising persistent: true at schemaVersion 1.2.0. |
tests/integration/testdata/bundles/bundle-with-persistent-params/porter.yaml |
New integration bundle demonstrating persistent parameter behavior. |
tests/integration/persistent_params_test.go |
New integration test validating persistence across install→upgrade. |
pkg/cnab/config-adapter/adapter_test.go |
Verifies manifest→bundle conversion includes the expanded persistent param + output wiring. |
docs/content/docs/development/authoring-a-bundle/persisting-data.md |
Documents persistent parameters as a third persistence mechanism with examples/restrictions. |
docs/content/docs/bundle/manifest/file-format/_index.md |
Adds schema 1.2.0 row and documents parameters.persistent field. |
docs/content/docs/bundle/manifest/file-format/1.2.0.md |
New schema 1.2.0 file format page focused on parameters.persistent. |
.github/workflows/porter-integration-pr.yml |
Runs the new persistent parameters integration test in PR CI. |
.github/workflows/porter-integration-release.yml |
Runs the new persistent parameters integration test in release CI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add explicit schema version check in expandPersistentParameters so a manifest with persistent: true but schemaVersion < 1.2.0 is rejected even when the feature flag is enabled. Add wrong_schema_version test case and set SchemaVersion: 1.2.0 in the test helper to keep existing tests valid. Signed-off-by: Kim Christensen <[email protected]>
|
We should investigate how
A bundle needing both features can only declare one |
Avoids duplicating the base semver range so it can't drift from the SupportedSchemaVersions constant. Signed-off-by: Kim Christensen <[email protected]>
Add persistent-parameters to the experimental feature flags section of the configuration docs so readers can discover it from the link in the 1.2.0 manifest file format page. Signed-off-by: Kim Christensen <[email protected]>
1.2.0 is a superset of 1.1.0, so bundles using persistent-parameters (schema 1.2.0) should also be able to use dependencies-v2. Signed-off-by: Kim Christensen <[email protected]>
|
Fixed in 257b5eb: changed the deps-v2 schema constraint from |
What does this change
Adds a
persistent: trueshorthand on parameter definitions so a value provided at install is automatically remembered for subsequent upgrade and uninstall runs — without manually wiring outputs and parameter sources.Enable the feature:
export PORTER_EXPERIMENTAL=persistent-parametersAt manifest validation time,
persistent: trueexpands into:/cnab/app/<name>source.output: <name>applyTolist covering all declared actions (including install)No changes to the CNAB adapter are required — after expansion the param is identical to the longhand.
What issue does it fix
Closes #1889
Notes for the reviewer
1.2.0is required; gated behind thepersistent-parametersexperimental feature flag (same pattern as DepsV2 /1.1.0)persistent: truehard-errors when combined withsource,path/env, orapplyToapplyTois set explicitly (includinginstall) to preventexemptFromInstall()from silently dropping install from the listChecklist