cue export: Render CUE to JSON or YAML
cue export config.cue --out yaml evaluates CUE and prints fully concrete JSON or YAML, failing if any value is still incomplete.
cue export turns a CUE configuration into concrete JSON or YAML for a deploy step. Because export requires concreteness, it doubles as a validation gate.
What it does
cue export evaluates a CUE instance and outputs the concrete result as JSON (default) or another format via --out. If any field is not fully resolved to a concrete value, export fails, so it both renders and validates config in one command.
Common usage
# export to JSON
cue export config.cue
# export a specific expression as YAML
cue export -e deployment --out yaml config.cue
# inject a tag value used by @tag() in the CUE
cue export -t env=prod config.cue
# export a whole package directory
cue export ./... --out yamlOptions
| Flag | What it does |
|---|---|
| --out json|yaml|text | Output format (default json) |
| -e <expr> | Export a specific expression/field |
| -t <k=v> | Inject a tag value for @tag(k) fields |
| -o <file> | Write output to a file |
| --force | Overwrite an existing output file |
In CI
Run cue export to generate the JSON/YAML your deploy consumes; because incomplete values make it exit non-zero, a config with an unset required field fails the build here instead of at apply time. Feed the output straight into kubectl or Helm in the next step.
Common errors in CI
some instances are incomplete; use the -c flag to show the errors or --force to override means a value never resolved to concrete; supply the missing input via -t or a data file. cannot convert incomplete value "string" to JSON names the incomplete field. expression "foo" not found means -e names a field that does not exist. conflicting values mirrors a vet-style unification failure.