Viewing template rendering results

The werf config render command displays the rendered result of werf.yaml or a specific image/images.

$ werf config render
project: demo-app
configVersion: 1
---
image: backend
dockerfile: backend.Dockerfile
$ werf config render backend
image: backend
dockerfile: backend.Dockerfile

Listing all built images

The werf config list command outputs a list of all images defined in the final werf.yaml.

$ werf config list
backend
frontend

The --final-images-only flag will display only the final images. You can learn more about final and intermediate images here.

Analyzing image dependencies

The werf config graph command builds a dependency graph between images (or a specific image).

$ werf config graph
- image: images/argocd
  dependsOn:
    dependencies:
    - images/argocd-source
- image: images/argocd-operator
  dependsOn:
    from: common/distroless
    import:
    - images/argocd-operator-artifact
- image: images/argocd-operator-artifact
- image: images/argocd-artifact
- image: images/argocd-source
  dependsOn:
    import:
    - images/argocd-artifact
- image: common/distroless-artifact
- image: common/distroless
  dependsOn:
    import:
    - common/distroless-artifact
- image: images-digests
  dependsOn:
    dependencies:
    - images/argocd-operator
    - images/argocd
    - common/distroless
- image: python-dependencies
- image: bundle
  dependsOn:
    import:
    - images-digests
    - python-dependencies
- image: release-channel-version-artifact
- image: release-channel-version
  dependsOn:
    import:
    - release-channel-version-artifact
$ werf config graph images-digests
- image: images-digests
  dependsOn:
    dependencies:
    - images/argocd-operator
    - images/argocd
    - common/distroless

Special debug functions

The --debug-templates flag enables advanced debugging mode for Go templates in werf.

In this mode:

  • Some errors become more detailed, including additional context that is hidden in normal mode.
  • Special functions for template debugging become available.
  • It is possible to output debug information to the log without affecting the result of the templating.

️ Note: This verbose error behavior is enabled by default when --debug-templates is used, but it is not active in normal mode to avoid accidentally disclosing potentially sensitive data (such as secrets or internal values).

Below are scenarios where these functions can be useful and their behavior depending on the debug mode.

Log an arbitrary message

You can insert custom log messages at any point during templating using printf_debug. This is useful for tracking variable values, condition execution, and the order of template rendering.

  • With --debug-templates: the message is printed to the log and does not affect the rendering result;
  • Without --debug-templates: the function does nothing.

Example:

{{ printf_debug (printf "Current value: %v" .Values.someVar) }}

Log a dump of any structure

If you need to inspect a variable’s value — especially a complex one like .Values or $ — use dump_debug.

  • With --debug-templates: the structure is logged in a human-readable format and does not affect the rendering result;
  • Without --debug-templates: the function does nothing.

Example:

{{ dump_debug $.Values.werf }}

Debug the include function

To debug include calls, replace them with include_debug and enable template debug mode using --debug-templates. This will log debug information about each include invocation during templating.

  • With --debug-templates: works like include, but also logs the template name, its content, and the rendered result;
  • Without --debug-templates: behaves like the standard include.

Example:

{{ include_debug "my-template" . }}

Debug the tpl function

To debug tpl calls, replace them with tpl_debug and enable template debug mode using --debug-templates. This will log debug information about each tpl invocation during templating.

  • With --debug-templates: works like tpl, but also logs the template string and the rendered result;
  • Without --debug-templates: behaves like the standard tpl.

Example:

{{ tpl_debug "{{ .Values.env }}" . }}