Skip to content

feat: add persistent parameter shorthand#3574

Open
kichristensen wants to merge 10 commits intogetporter:mainfrom
kichristensen:persistentParameters
Open

feat: add persistent parameter shorthand#3574
kichristensen wants to merge 10 commits intogetporter:mainfrom
kichristensen:persistentParameters

Conversation

@kichristensen
Copy link
Contributor

@kichristensen kichristensen commented Mar 22, 2026

What does this change

Adds a persistent: true shorthand 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.

schemaVersion: 1.2.0

parameters:
  - name: resource-group
    type: string
    persistent: true

Enable the feature:

export PORTER_EXPERIMENTAL=persistent-parameters

At manifest validation time, persistent: true expands into:

  • a file destination at /cnab/app/<name>
  • source.output: <name>
  • an explicit applyTo list covering all declared actions (including install)
  • a matching output definition (unless one already exists)

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

  • Schema version 1.2.0 is required; gated behind the persistent-parameters experimental feature flag (same pattern as DepsV2 / 1.1.0)
  • persistent: true hard-errors when combined with source, path/env, or applyTo
  • applyTo is set explicitly (including install) to prevent exemptFromInstall() from silently dropping install from the list

Checklist

  • Did you write tests?
  • Did you write documentation?
  • Did you change porter.yaml or a storage document record? Update the corresponding schema file.
  • If this is your first pull request, please add your name to the bottom of our Contributors list. Thank you for making Porter better! 🙇‍♀️

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]>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (schemaVersion 1.2.0, gated by persistent-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]>
@kichristensen
Copy link
Contributor Author

We should investigate how dependencies-v2 and persistent-parameters interact at the schema version level.

  • dependencies-v2 requires schemaVersion: 1.1.0
  • persistent-parameters requires schemaVersion: 1.2.0

A bundle needing both features can only declare one schemaVersion, so there is currently no valid version that satisfies both flags simultaneously. Worth deciding whether 1.2.0 should be a superset that also enables deps-v2 features, or whether the version gating strategy needs revisiting.

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]>
@kichristensen
Copy link
Contributor Author

Fixed in 257b5eb: changed the deps-v2 schema constraint from || 1.1.0 to || >= 1.1.0, so any schema version ≥ 1.1.0 (including 1.2.0) is valid when the flag is enabled. A bundle can now declare schemaVersion: 1.2.0 and use both features with both flags set.

@kichristensen kichristensen marked this pull request as ready for review March 25, 2026 21:10
@kichristensen kichristensen requested a review from a team as a code owner March 25, 2026 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Persistent parameters

2 participants