Skip to content

feat(deploy): add --export-rendered flag to save expanded topology YAML#3145

Open
Aprazor wants to merge 1 commit intosrl-labs:mainfrom
Aprazor:feat/save-rendered-topology
Open

feat(deploy): add --export-rendered flag to save expanded topology YAML#3145
Aprazor wants to merge 1 commit intosrl-labs:mainfrom
Aprazor:feat/save-rendered-topology

Conversation

@Aprazor
Copy link
Copy Markdown
Contributor

@Aprazor Aprazor commented Mar 30, 2026

Summary

When using topology templates (*.clab.gotmpl) with variables files, the final rendered YAML only exists in memory and is lost after deploy. This makes it hard to debug template issues or version-control the rendered output.

Adds --export-rendered <path> flag to the deploy command that saves the fully expanded YAML (after template execution and env var substitution) to the specified file path before unmarshaling.

clab deploy -t lab.clab.gotmpl --export-rendered /tmp/lab-rendered.yaml

The saved file contains the final YAML exactly as containerlab would parse it — all template logic resolved and all ${ENV_VARS} substituted.

Closes #3013

Testing

  • go vet ./cmd/... ./core/... — clean
  • go test -race ./cmd/... ./core/... — all pass
  • The flag is a pure additive feature with no impact on existing behavior when omitted

When using topology templates (*.clab.gotmpl) with variables files,
the final rendered YAML only exists in memory and is lost after deploy.
This makes it hard to debug template issues or version-control the
rendered output.

Add --export-rendered <path> flag to the deploy command that saves the
fully expanded YAML (after template execution and env var substitution)
to the specified file path before unmarshaling.

Closes srl-labs#3013
@hellt hellt self-assigned this Apr 2, 2026
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.

Add an option to save the topology file generated from the topo template and provided vars file

2 participants