Simple modern alternative to GNU Make. taskctl allows you to design you development workflow pipelines in nice and neat way in human-readable format (YAML, JSON or TOML). Each pipeline composed of tasks or other pipelines and allows them to run in parallel or one-by-one. Beside pipelines, each single task can be performed manually or triggered by built-in filesystem watcher.
- Parallel tasks execution
- Highly customizable pipelines configuration
- stderr/stdout output capturing
- File watcher integrated with tasks and pipelines
- Customizable contexts for each task
- Human-readable configuration format (YAML, JSON or TOML)
- and many more...
- Getting started
- Tasks
- Pipelines
- Filesystem watchers
- Contexts
- Config example
- FAQ
- Autocomplete
- Similar projects
brew tap taskctl/taskctl
brew install taskctl
or just
brew install taskctl/taskctl/taskctl
or
sudo curl -Lo /usr/local/bin/taskctl https://github.com/taskctl/taskctl/releases/latest/download/taskctl_darwin_amd64
sudo chmod +x /usr/local/bin/taskctl
sudo wget https://github.com/taskctl/taskctl/releases/latest/download/taskctl_linux_amd64 -O /usr/local/bin/taskctl
sudo chmod +x /usr/local/bin/taskctl
go get -u github.com/taskctl/taskctl/cmd/taskctl
taskctl run pipeline1 // single pipeline
taskctl run pipeline1 pipeline2 // multiple pipelines
taskctl run task1 // single task
taskctl run task1 task2 // multiple tasks
taskctl run pipeline1
taskctl watch watcher1
taskctl -c tasks.yaml run lint
taskctl -c https://raw.githubusercontent.com/taskctl/taskctl/master/example/full.yaml run task4
Task is a foundation of taskctl. It describes one or more commands to run, their environment, executors and attributes such as working directory, execution timeout, acceptance of failure, etc.
tasks:
lint:
allow_failure: true
command:
- golint $(go list ./... | grep -v /vendor/)
- go vet $(go list ./... | grep -v /vendor/)
build:
command: go build ./...
env:
GOOS: linux
GOARCH: amd64
after: rm -rf tmp/*Task definition takes following parameters:
name- task name (optional)command- one or more commands to runvariations- list of variations to apply to commandcontext- name of the context to run commands in (optional).localby defaultenv- environment variables (optional). All existing environment variables will be passed automaticallydir- working directory. If not set, current working directory will be usedtimeout- command execution timeout (optional)allow_failure- if set totruefailed commands will no interrupt task execution.falseby defaultafter- command that will be executed after command completes
Every task may run one or more variations. It allows to reuse task with different env variables:
tasks:
build:
command:
- GOOS=${GOOS} GOARCH=amd64 go build -o bin/taskctl_${GOOS} ./cmd/taskctl
env:
GOFLAGS: -ldflags=-s -ldflags=-w
variations:
- GOOS: linux
- GOOS: darwin
- GOOS: windowsthis config will run build 3 times with different build GOOS
Pipeline is a set of stages (tasks or other pipelines) to be executed in a certain order. Stages may be executed in parallel or one-by-one. Stage may override task environment.
This configuration:
pipelines:
pipeline1:
- task: start task
- task: task A
depends_on: "start task"
- task: task B
depends_on: "start task"
- task: task C
depends_on: "start task"
- task: task D
depends_on: "task C"
- task: task E
depends_on: ["task A", "task B", "task D"]
- task: finish
depends_on: ["task A", "task B", "finish"]
tasks:
start task: ...
task A: ...
task B: ...
task C: ...
task D: ...
task E: ...
finish: ...
will create this pipeline:
|‾‾‾ task A ‾‾‾‾‾‾‾‾‾‾‾‾‾‾|
start task --- |--- task B --------------|--- task E --- finish
|___ task C ___ task D ___|
Stage definition takes following parameters:
name- stage name (optional). If not set - referenced task or pipeline name will be used.task- task to execute on this stage (optional)pipeline- pipeline to execute on this stage (optional)env- environment variables (optional). All existing environment variables will be passed automaticallydepends_on- name of stage on which this stage depends on (optional). This stage will be started only after referenced stage is completed.allow_failure- if set totruefailing stage will no interrupt pipeline execution.falseby default
Watcher watches for changes in files selected by provided patterns and triggers a task anytime an event has occurred.
watchers:
watcher1:
watch: ["README.*", "pkg/**/*.go"]
exclude: ["pkg/excluded.go", "pkg/excluded-dir/*"]
events: [create, write, remove, rename, chmod]
task: task1Contexts allows you to set up execution environment, shell or binaries which will run your task, up/down commands etc Available context types:
- local (shell or binary)
- remote (ssh)
- container (docker, docker-compose, kubernetes via kubectl)
contexts:
local:
type: local
executable:
bin: /bin/zsh
args:
- -c
env:
VAR_NAME: VAR_VALUE
before: echo "I'm local context!"
after: echo "Have a nice day!" mysql:
type: container
container:
provider: docker
image: mysql:latest
executable:
bin: mysql
args:
- -hdb.example.com
- -uroot
- -psecure-password
- database_name
- -e
tasks:
mysql-task:
context: mysql
command: TRUNCATE TABLE queueIt is stored in $HOME/.taskctl/config.yaml file
It's amazing how solving same problems lead to same solutions. taskctl and go-task have a lot of concepts in common but also have some differences.
- Main is pipelines. Pipelines and stages allows more precise workflow design because same tasks may have different dependencies (or no dependencies) in different scenarios.
- Contexts allows you to set up execution environment, shell or binaries which will run your task. Now there is several available context types: local (shell or binary), remote (ssh), container (docker, docker-compose, kubernetes via kubectl)
Add to ~/.bashrc or ~/.profile
. <(taskctl completion bash)
Add to ~/.zshrc
. <(taskctl completion zsh)
