Condukt.Workflows.Compiler (Condukt v1.5.1)

Copy Markdown View Source

Normalizes .exs workflow files to workflow documents.

An .exs workflow is an Elixir script whose final expression evaluates to a map describing the workflow. This is a low-level generation escape hatch. Human-authored workflow files should generally use HCL and let Condukt.Workflows.HCLCompiler produce the same map.

Atom keys and atom values (other than nil, true, false) are normalized to strings; the rest of the data must already match the workflow document shape.

Standard Elixir features (def inside a defmodule, anonymous functions, for, if, comprehensions, Enum, etc.) are available for document generation. References between steps are written as plain ${...} expression strings.

# hello.exs
%{
  inputs: %{name: %{type: :string}},
  steps: %{greet: %{kind: :cmd, argv: ["echo", "Hello, ${inputs.name}"]}},
  output: "${steps.greet.stdout}"
}

Summary

Functions

Reads, evaluates, and normalizes an .exs workflow file.

Evaluates an .exs workflow source string. path is used only for error reporting.

Functions

compile(path)

Reads, evaluates, and normalizes an .exs workflow file.

Returns {:ok, decoded_map} where the map is ready for workflow document validation.

compile_string(source, path)

Evaluates an .exs workflow source string. path is used only for error reporting.