Regulators is a hackathon project to create a simple, pluggable system to create approval workflows in CD/CI pipelines, provide checks in a deployment system or for any other use. These workflow tasks could include locks, code review verification, safety and security checks, alarm validation, etc.
You must have Docker and Rust installed.
# Build
$ cargo build
# Run server
$ cargo run
docker build -t regulators .
docker run -it --rm --publish 9000:8000 --name regulators regulators
The JSON data for POST /regulate
should be something like this:
{
"regulators": [{
"name": "regulators-acquire-lock",
"context": {
"lock_key": "foo::bar"
}
}, {
"name": "regulators-code-review-verification",
"context": {
"repository": "https://github.com/mmerkes/Regulators",
"required_approvers": 1
}
}, {
"name": "MyCustomRegulator",
"context": {
"foo": "bar"
}
}]
}
The /regulate
API calls Lambdas asynchronously and waits for them to complete their tasks via the PUT /workflows/:workflow/tasks/:task
API. It will send them content in the following format:
{
"workflow_id": "some-id",
"task_id": "some-task",
"context": {
"keys": "exactly like the customer called with"
}
}
Gets the workflow information by workflow ID.
Gets the task information by workflow and task ID.
This API is used to complete tasks and trigger next events once the last task is completed. The JSON data for the PUT /workflows/:workflow/tasks/:task
should be something like this:
{
"status": "Succeeded"
}
Possible statuses are Succeeded
and Failed
.