-
Notifications
You must be signed in to change notification settings - Fork 26
/
Makefile
37 lines (29 loc) · 1.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
red=\033[0;31m
color_reset=\033[0m
# Check if venv is loaded before doing any changes
ensure-venv:
@if [ ! -d ".venv" ]; then \
echo "$(red)Virtual environment not found. Please run:$(color_reset) make venv"; \
exit 1; \
fi
@if [ -z "$$VIRTUAL_ENV" ]; then \
echo "$(red)Activate yout venv with:$(color_reset) source .venv/bin/activate"; \
exit 1; \
fi
ensure-shellcheck:
@command -v shellcheck > /dev/null || { echo "shellcheck is not installed. Please install shellcheck"; exit 1; }
@command -v shellcheck-sarif > /dev/null || { echo "shellcheck-sarif is not installed. Please install shellcheck-sarif"; exit 1; }
venv-build:
@python3 -m venv .venv
@$(MAKE) venv-update
@echo "Virtual environment created. Run $(red)'source .venv/bin/activate'$(color_reset) to activate it."
venv-update:
@source .venv/bin/activate; pip install --upgrade pip; pip install -r requirements.txt
venv: venv-build venv-update
verify: ensure-venv ensure-shellcheck
@.ci/verify-bandit
@.ci/verify-shellcheck
build: ensure-venv
@.ci/build
build-image: build
@docker build -t ops-toolbelt -f generated_dockerfiles/ops-toolbelt.dockerfile . --no-cache