Defines the callbacks every Marea plugin can implement.
Always loaded as the last plugin in the chain. The default
implementations simply return {:cont, ...}, so a plugin that doesn't
override a callback is transparent to it.
Plugins are stacked via Malla.Plugin. To execute a callback, Marea
calls Malla.local/3 and walks the chain in order, each plugin
returning {:cont, args} to pass control on or a final value to stop.
See each callback's docs below for the contract and return shapes, and the Base Plugin guide for the wider picture.
Built-in commands
Base also implements marea schema show (and marea schema show --json) for inspecting the plugin-enriched marea.yaml schema —
the schema is rebuilt by running the
marea_config_schema/1 chain, so any fields contributed by
configured plugins appear in the output.
Summary
Callbacks
@callback marea_cmd(cmds :: [atom()], config :: Marea.Config.t()) :: :ok | {:ok, Marea.Config.t()} | :usage | {:cmd, String.t()} | {:cmd, String.t(), Marea.Config.t()} | {:error, term()} | :cont | {:cont, [atom()], Marea.Config.t()}
Execute a CLI command.
Receives the parsed command list (e.g. [:build, :docker]) and the
full Marea.Config.t/0. Match the prefix your plugin owns and
return one of:
:ok— command succeeded; save last values, no deferred command.{:ok, config}— same, with an updated config.:usage— display help/usage for the given command.{:cmd, cmd}— deferred shell command written to.marea/next_cmd.{:cmd, cmd, config}— same, but with an updated config.{:error, error}— abort with the given error message.:cont— pass control to the next plugin.
@callback marea_config_args(args :: Marea.Config.Args.args()) :: {:cont, [Marea.Config.Args.args()]} | term()
Enrich the CLI args configuration.
Receives the args map (see Marea.Config.Args) and may add options,
flags, or subcommands using Marea.Config.Args.add_options/2,
Marea.Config.Args.add_flags/2, Marea.Config.Args.add_subcommands/2.
Return {:cont, [args]} to pass the modified config on.
Base contributes the schema show subcommand here.
@callback marea_config_schema(schema :: Zoi.schema()) :: {:cont, [Zoi.schema()]} | term()
Enrich the Zoi schema for marea.yaml.
Each plugin receives the schema and may add fields via
Marea.Config.Schema.add_field_at_path/4. Return {:cont, [schema]} to pass
the modified schema to the next plugin.
Contribute deploy backend types.
Each plugin receives the accumulated list of deploy type: atoms and
may append its own (e.g. :helm, :kustomize). Append, don't
replace — every plugin owns a distinct atom. Return {:cont, [types]}
to pass the list on. The collected list becomes the
deploys.<d>.type enum in the schema (see
Marea.Config.Schema.base_schema/2); a single contributed type also
becomes the default.
Provide the content for a release file during setup init-release.
Currently called with :env_sh_eex to render rel/env.sh.eex.
Contribute release build types.
Mirrors marea_deploy_types/1 but for the
deploys.<d>.releases.<r>.type enum (today contributed by
Marea.Plugins.Docker as :elixir and :dockerfile_dir). Append,
don't replace.
Compute the release version string.
By default returns a date+git version (Marea.Plugins.Build provides
this). Override in a plugin to customize.