Mass Alpha Stash Set
mass alpha stash set​
Set a stash entry's value
Synopsis​
Set Stash Entry
Stores a value under a key. Each set replaces the whole entry: the value, label, format, TTL, and flags all come from this write. A flag that you leave out goes back to its default.
A value of - reads the value from standard input and keeps every byte, including a trailing newline.
Keys that start with md/ are well-known keys. The server checks the value against the key's schema, and the Massdriver UI draws a widget from it. A well-known key cannot be sensitive. See https://docs.massdriver.cloud/guides/stash/well-known-keys
Usage​
mass alpha stash set <scope>.<key> <value> [flags]
Flags​
--label: A name for the entry, up to 255 characters. An entry with a label shows as a row on the Metadata panels in the UI. The label is not encrypted and shows even for sensitive entries, so keep secrets out of it.--format:text(default) orjson. Ajsonvalue must be a JSON object. The API also returns it parsed.--ttl: Delete the entry this many seconds after the write, up to 10 years. An expired entry is not returned.--immutable: Keep the first value. Later writes fail until the entry expires or is deleted, so a step can use it to run only once.--sensitive: Encrypt the value with your organization's key. Callers withoutstash:exportsee it masked. It is never sent in events and never shown in notes or widgets.
A value can be up to 65536 bytes. A stash can hold up to 1000 keys.
Examples​
Pass a value to a later deployment step, with a label for the Metadata tab:
mass alpha stash set "$MASSDRIVER_DEPLOYMENT_ID.db/hostname" "$DB_HOST" --label "Database hostname"
Run migrations only once per deployment:
if mass alpha stash set "$MASSDRIVER_DEPLOYMENT_ID.migrations/ran" true --immutable; then
./run-migrations.sh
fi
Store JSON:
mass alpha stash set "$MASSDRIVER_DEPLOYMENT_ID.stats" "$(jq -n '{duration_s: 412, changed: 3}')" --format json
Record a step's changes as a deployment result:
mass alpha stash set "$MASSDRIVER_DEPLOYMENT_ID.md/v1/changes/$MASSDRIVER_STEP_PATH" \
'{"tool": "opentofu", "add": 2, "change": 3, "destroy": 0}' --format json
Show traffic on an instance's lines on the canvas. The TTL removes it when the writer stops:
mass alpha stash set billing-dev-app.md/v1/traffic '{"rps": 240, "errors_5m": 2, "p95_ms": 180}' --format json --ttl 600
Add runbook links to an environment's header:
mass alpha stash set billing-dev.md/v1/links \
'{"links": [{"label": "Runbook", "url": "https://wiki.example.com/billing"}]}' --format json
Keep a secret for a later step, read from standard input:
terraform output -raw kubeconfig | mass alpha stash set billing-dev.kubeconfig - --sensitive
mass alpha stash set <scope>.<key> <value> [flags]
Options​
--format string How the value is read (text, json) (default "text")
-h, --help help for set
--immutable Keep the first value; later writes fail
--label string Human-readable name for the entry, up to 255 characters
--sensitive Encrypt the value and hide it from callers without stash:export
--ttl int Delete the entry this many seconds after the write
Options inherited from parent commands​
--profile string Configuration profile to use (overrides MASSDRIVER_PROFILE and the active profile)
SEE ALSO​
- mass alpha stash - Share values between deployments, scripts, and the Massdriver UI