Skip to content

feat: add persistent parameter shorthand#3574

Draft
kichristensen wants to merge 5 commits intogetporter:mainfrom
kichristensen:persistentParameters
Draft

feat: add persistent parameter shorthand#3574
kichristensen wants to merge 5 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 <kimworking@gmail.com>
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 <kimworking@gmail.com>
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 <kimworking@gmail.com>
Signed-off-by: Kim Christensen <kimworking@gmail.com>
Signed-off-by: Kim Christensen <kimworking@gmail.com>
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

1 participant