Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,30 @@ You can run:
makim clean --cache
```

### Arguments Validation

Makim also allows extra validation following the
[JSON schema validation](https://json-schema.org/draft/2020-12/json-schema-validation#name-validation-keywords-for-num),
you can provide validation options similar to JSON schema validation options:

```yaml
{% raw %}
tasks:
create-cluster:
help: Create a Kubernetes cluster with a specific number of nodes
args:
node-count:
help: number of nodes
type: integer
validations:
minimum: 1
maximum: 100
required: true
run: |
echo "Creating Kubernetes cluster with ${{ args.node-count }} nodes..."
{% endraw %}
```

### Benefit

- Prevents hardcoded parameters in scripts.
Expand Down Expand Up @@ -174,8 +198,8 @@ Makim automatically expands this into multiple runs for each combination.

### What It Does

Makim provides `pre-run` and `post-run` hooks to execute tasks before or after
another task runs.
Makim provides `pre-run`, `post-run` and `failure` hooks to execute tasks before
or after another task runs or after task execution fails.

### Use Case

Expand All @@ -191,6 +215,8 @@ groups:
- task: build.clean
post-run:
- task: build.notify
failure:
- task: build.failure-notify
run: echo "Compiling source code..."

clean:
Expand All @@ -200,6 +226,10 @@ groups:
notify:
help: Notify team about successful compilation
run: echo "Build completed successfully!"

failure-notify:
help: Notify team about build failure
run: echo "Build failed! Alerting the team..."
```

### Skipping Hooks
Expand Down
81 changes: 73 additions & 8 deletions docs/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ tasks:
help: <description>
args: <arguments>
env: <environment_variables>
hooks: <pre/post-run_hooks>
hooks: <pre-run/post-run/failure_hooks>
matrix: <parameter_combinations>
log: <file_logging_configuration>
if: <validation_conditionals>
options: <additional_options>
run: <command>
{% endraw %}
```
Expand All @@ -103,8 +105,8 @@ tasks:

### Description

Defines arguments that tasks can accept with types, defaults, and help
descriptions.
Defines arguments that tasks can accept with types, defaults,help descriptions
and validation options.

### Structure

Expand All @@ -115,16 +117,27 @@ args:
default: <default_value>
interactive: <true/false>
help: <description>
validations:
<validation-type>: <validation_value>
```

> You can provide `validation-type` options similar to
> [JSON schema validation options](https://json-schema.org/draft/2020-12/json-schema-validation#name-validation-keywords-for-num)

### Example

```yaml
args:
env:
type: str
type: string
default: "dev"
help: Environment setting
username:
type: string
help: Username for system access
validations:
min-length: 3
max-length: 32
```

---
Expand All @@ -134,8 +147,8 @@ args:
### 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.
executes or after (`failure`) a task execution fails. They can also include an
`if` condition to control when the hook should be triggered.

### Structure

Expand All @@ -147,6 +160,9 @@ hooks:
post-run:
- task: <task_name>
if: <condition>
failure:
- task: <task_name>
if: <condition>
```

### Example
Expand All @@ -161,6 +177,8 @@ tasks:
if: ${{ vars.REBUILD == "true" }}
post-run:
- task: notify
failure:
- task: failure-notify
run: echo "Building project..."
{% endraw %}
```
Expand Down Expand Up @@ -397,7 +415,54 @@ tasks:

---

## 12. Variables
## 12. Ignore Error Option

### Description

The `ignore-errors` option allows a task to continue executing subsequent tasks
even if it fails. When `ignore-errors: true` is set under `options`, the failure
of that task does not interrupt the execution flow.

### Structure

```yaml
options:
ignore-errors: <true/false>
```

> The default value for `ignore-errors` is set to `false`

### Example

```yaml
groups:
deploy:
tasks:
clear-cache:
help: Attempt to clear CDN cache (optional)
options:
ignore-errors: true
run: |
echo "Clearing CDN cache..."
# Simulate possible failure
assert 1 == 2

deploy-app:
help: Deploy the application
run: echo "Deploying application to production..."

main-deploy:
help: Deployment pipeline
hooks:
pre-run:
- task: deploy.clear-cache
- task: deploy.deploy-app
run: echo "Deployment complete."
```

---

## 13. Variables

### Description

Expand Down Expand Up @@ -434,7 +499,7 @@ tasks:
{% endraw %}
```

## 13. Environment Variables
## 14. Environment Variables

### Description

Expand Down
Loading