Makim Specification¶
Overview¶
Makim uses a YAML-based configuration file (.makim.yaml
) to define tasks,
dependencies, and execution environments. This document provides a detailed
specification of all components available in a Makim configuration file.
1. File Structure¶
A .makim.yaml
file consists of the following top-level sections:
groups
scheduler
hosts
vars
env
env-file
Each section is explained below in detail.
2. Groups¶
Description¶
Defines collections of related tasks. Each group contains tasks and environment variables specific to that group.
Structure¶
Example¶
groups:
build:
env:
BUILD_DIR: dist
tasks:
clean:
help: Clean build artifacts
run: rm -rf ${{ env.BUILD_DIR }}
compile:
help: Compile the project
run: echo "Compiling..."
3. Tasks¶
Description¶
Tasks define executable commands with optional arguments, dependencies, and hooks.
Structure¶
tasks:
<task_name>:
help: <description>
args: <arguments>
env: <environment_variables>
hooks: <pre/post-run_hooks>
matrix: <parameter_combinations>
run: <command>
Example¶
tasks:
test:
help: Run tests
args:
verbose:
type: bool
action: store_true
run: pytest --verbose=${{ args.verbose }}
4. Arguments¶
Description¶
Defines arguments that tasks can accept with types, defaults, and help descriptions.
Structure¶
args:
<arg_name>:
type: <type>
default: <default_value>
interactive: <true/false>
help: <description>
Example¶
5. Hooks¶
Description¶
Hooks define tasks that run before (pre-run
) or after (post-run
) a task
executes. They can also include an if
condition to control when the hook
should be triggered.
Structure¶
Example¶
tasks:
build:
hooks:
pre-run:
- task: clean
if: ${{ vars.REBUILD == "true" }}
post-run:
- task: notify
run: echo "Building project..."
6. Environment Variables¶
Description¶
Defines global, group, or task-specific environment variables.
Structure¶
Example¶
Note:¶
⚠️ The value of an environment variable should always be a string. If you need
to pass an integer, wrap it in quotes (""
) to avoid type issues.
7. Matrix Configuration¶
Description¶
Defines multiple combinations of parameters for running a task.
Structure¶
Example¶
8. Scheduler¶
Description¶
Defines scheduled tasks using cron syntax, allowing periodic execution of tasks.
Structure¶
Example¶
Understanding Cron Syntax¶
A cron expression consists of five fields, each representing a time unit:
Field | Value Range | Example | Meaning |
---|---|---|---|
Minute | 0-59 |
30 |
Runs at 30th minute |
Hour | 0-23 |
2 |
Runs at 2 AM |
Day of Month | 1-31 |
15 |
Runs on the 15th day of the month |
Month | 1-12 |
6 |
Runs in June |
Day of Week | 0-6 (Sunday = 0) |
1 |
Runs on Monday |
Common Cron Examples¶
0 0 * * *
→ Runs daily at midnight30 14 * * 5
→ Runs every Friday at 2:30 PM
For a detailed guide on cron syntax, visit:
9. Remote Hosts¶
Description¶
Defines SSH configurations for executing tasks on remote servers. Additionally,
tasks can specify a remote
entry to execute commands on a defined host.
Structure¶
Using Remote Execution Inside a Task
Example¶
1. Define Remote Host¶
2. 2. Execute Task on Remote Server¶
Explanation:
- The
hosts
section defines theproduction
remote server. - The
deploy
task specifiesremote: production
, ensuring it runs onexample.com
via SSH.
10. Variables¶
Description¶
Defines reusable variables that can be referenced throughout the configuration.
Supported Scopes:¶
- Global – Available everywhere.
- Group – Available within a specific group.
- Task – Available only within a task.
Structure¶
Example¶
This can be used in tasks as:
11. Environment Variables¶
Description¶
Loads environment variables from an external .env
file. This is useful for
managing secrets and configurations separately.
Supported Scopes:¶
- Global – Available everywhere.
- Group – Available within a specific group.
- Task – Available only within a task.
Structure¶
Example¶
This will automatically load the environment variables defined in .env
.