-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (48 loc) · 2.48 KB
/
Copy pathMakefile
File metadata and controls
62 lines (48 loc) · 2.48 KB
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
53
54
55
56
57
58
59
60
61
62
.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
prek 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 -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 -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: build
build: .venv ## Build the docker image. Ex: `make build image_name=alertmanager`
uv run 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
.PHONY: scan
scan: .venv ## Scan the docker image with Endor Labs. Ex: `make scan image_name=alertmanager`
@command -v endorctl >/dev/null || { echo "endorctl not found. Install: https://docs.endorlabs.com/deployment/install-endorctl/"; exit 1; }
@test -n "$$ENDOR_API_CREDENTIALS_KEY" -a -n "$$ENDOR_API_CREDENTIALS_SECRET" -a -n "$$ENDOR_NAMESPACE" || \
{ echo "Set ENDOR_API_CREDENTIALS_KEY, ENDOR_API_CREDENTIALS_SECRET, ENDOR_NAMESPACE before running scan"; exit 1; }
uv run bin/scan-endorctl.py --image=ap-$(image_name):$(image_tag) --path=$(image_name)
PHONY: venv
venv: .venv ## Create the needed virtualenv
.venv:
uv sync
.PHONY: clean
clean: ## Delete build artifacts
rm -rf .venv
.PHONY: uv-lock-upgrade
uv-lock-upgrade: ## Upgrade dependencies in the uv.lock file.
uv lock --upgrade
.PHONY: uv-lock-upgrade-and-sync
uv-lock-upgrade-and-sync: uv-lock-upgrade ## Upgrade uv lockfile dependencies and sync venv
uv sync