Compare build tools invoke
and make
.
The use case is a multi-project setup, i.e. multiple projects are hosted in a single git repo. Each sub project creates it's own Docker image.
Enable YAML configuration files for SHELL
scripts:
pip install --user yq
make with Makefile | invoke with tasks |
---|---|
+ well known standard | + yaml as config files |
+ shell scripts with highlighting in IDE | + Python instead of shell scripting |
+ less lines of code (2/3) | . |
- Shell scripts need to adopt specific $$ syntax | . |
+ can run targets in parallel | - parallelism not supported |
runs with local environment by default
make build
run with specific environment
env ENVIRONMENT=development make build
run in parallel
make --jobs --output-sync=recurse --no-keep-going build
measure time for parallel run
MY_DATE=$(date); make --jobs --output-sync=recurse --no-keep-going build; echo $MY_DATE; (date)
run from root (includes all sub-projects)
inv -f configs/local.yaml build
run sepcific sub-project
inv -f configs/local.yaml project-a.build
# or
inv -f configs/local.yaml --search-root ./tasks --collection project_a build
For multiple commands use sub-shell
(export ENVIRONMENT=development; make build && make release)
or a single command in a sub-shell use env
env ENVIRONMENT=development make build
Install invoke
pip3 install --user invoke docker
and list all available invoke targets
inv --list
and execute a chain of targets
inv deploy release
Execute invoke with a given config file
inv -f configs/local.yaml build
# or
inv -f configs/development.yaml build