-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
52 lines (40 loc) · 2.13 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
.DEFAULT_GOAL := help
image_name:=
image_tag:=latest
image_test_config:=$(image_name)/test.yaml
.PHONY: help
help: ## Print Makefile help.
@grep -Eh '^[a-z.A-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[1;36m%-28s\033[0m %s\n", $$1, $$2}'
.PHONY: install-hooks
install-hooks: ## Install git hooks
command -v pre-commit || pip3 install --user --upgrade pre-commit
pre-commit install -f --install-hooks
.PHONY: show-quay-urls
show-quay-urls: ## Show Quay.io URLS for all images in repo
@find . -mindepth 1 -maxdepth 1 -type d -iname '[a-z]*' ! -name bin ! -name requirements -print | sort | sed 's#^\./\(.*\)#https://quay.io/repository/astronomer/ap-\1?tab=tags#'
.PHONY: show-quay-pull-urls
show-quay-pull-urls: ## Show Quay.io pull for all images in repo
@find . -mindepth 1 -maxdepth 1 -type d -iname '[a-z]*' ! -name bin ! -name requirements -print | sort | while read -r dir ; do echo "quay.io/astronomer/ap-$${dir:2}:$$(cat $$dir/version.txt)" ; done ;
.PHONY: update-fluentd-gemfile.lock
update-fluentd-gemfile.lock: ## Update the fluentd Gemfile.lock file
docker run -v "$$PWD/fluentd/include:/docker-share" --workdir=/docker-share --rm -ti ruby bundle update
.PHONY: update-requirements
update-requirements: ## Update all requirements.txt files
for FILE in requirements/*.in ; do pip-compile --quiet --generate-hashes --allow-unsafe --upgrade $${FILE} ; done ;
-pre-commit run requirements-txt-fixer --all-files --show-diff-on-failure
.PHONY: build
build: venv ## Build the docker image. Ex: `make build image_name=alertmanager`
venv/bin/python ./bin/docker-operations.py build --project_path=$(image_name) --image=ap-$(image_name)
.PHONY: test
test: export ASTRO_IMAGE_NAME = ap-$(image_name)
test: export ASTRO_IMAGE_TAG = $(image_tag)
test: export ASTRO_IMAGE_TEST_CONFIG_PATH = $(image_test_config)
test: venv ## Test the docker image. Ex: `make test image_name=alertmanager`
env | grep ASTRO
venv/bin/pytest -v -s bin/test.py
venv: ## Create the needed virtualenv
python3 -m venv venv
venv/bin/pip install -r requirements/requirements.in
.PHONY: clean
clean: ## Delete build artifacts
rm -rf venv