Variables#
Declare a variable#
Add a
variablesblock tokevin.cue:variables: region: default: "us-east-1"Omit
defaultto make the variable required.Read it in a
withblock:env: app: { uses: "builtin:container" with: env: REGION: "${vars.region}" }Check the result:
kevin validate
Declare a typed variable#
Add a
typeconstraint alongside (or instead of)default. See the#Variablefield table for the CUE expressionstypeaccepts:variables: { replicas: {type: int & >=1 & <=10, default: 3} env_name: {type: "prod" | "staging" | "dev", default: "dev"} strict: {type: bool} }A variable with no
typeis a plain string.Read it the same way, in any field the plugin’s own schema types to match:
env: app: { uses: "builtin:container" with: replicas: "${vars.replicas}" }Check the result:
kevin validateA value outside the declared constraint fails validation with the constraint it violated.
Use a variable in a plugin’s config block#
Read
${vars.<name>}in aplugins.<name>.configblock, the same way as awithblock:variables: registry_size: {type: int, default: 2} plugins: registry: { cmd: "kevin-plugin-registry" config: replicas: "${vars.registry_size}" }Check the result:
kevin validate
Supply a value#
Use one of these, highest precedence first:
kevin run --var region=eu-west-1
KEVIN_VAR_REGION=eu-west-1 kevin run
kevin run --var-file secrets.envA var-file holds one KEY=VALUE per line:
cat > secrets.env <<'EOF'
# comments and blank lines are skipped
region=eu-west-1
EOFA typed variable parses the supplied value as CUE syntax rather than taking it literally - see the #Variable field table for how each source is parsed.
Mark a variable sensitive#
Add
sensitive: trueto the variable:variables: api_key: sensitive: trueSupply the value the same way as any other variable:
kevin run --var api_key=sk-123
A field that reads ${vars.api_key} shows as redacted in the console’s Inputs tab and in get_step’s MCP output, whether the field also carries @sensitive() in its plugin’s schema or not.
Related#
- Environment file: variables
- CEL expressions: vars
- Per-machine and per-run settings - the CUE
@tagalternative, for a package-mode environment file