-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
93 lines (73 loc) · 2.68 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
-include .env
export
PYTHON_VERSION=3.11.0
python-setup:
pyenv install --skip-existing $(PYTHON_VERSION)
pyenv local $(PYTHON_VERSION)
venv:
pyenv exec python -m venv .venv
. .venv/bin/activate && \
pip install -r requirements.txt
black:
black .
security-check: detect-secrets detect-vulnerabilities
detect-secrets:
@git ls-files -z | xargs -0 detect-secrets-hook --baseline .secrets.baseline
ignore-secrets:
detect-secrets scan > .secrets.baseline
detect-vulnerabilities:
bandit -r infrastructure/ templates/ utils/
lint:
pylint --disable=R,C,W --ignore-paths docs/ *.py
infra/init:
pulumi login $(INFRA_BUCKET)
# Define common variables
DIR = $(CONFIG_REPO_PATH)/src/$(layer)/$(instance)
DIR_UNIVERSAL = $(CONFIG_REPO_PATH)/$(UNIVERSAL_STACK_NAME)
DIR_INFRA = $(CONFIG_REPO_PATH)/$(INFRA_STACK_NAME)
BASE_ARGS = --show-replacement-steps --refresh
infra/set-stack:
PYTHONPATH=$(dir) pulumi stack select $(stack) --create
infra/apply:
ifeq ($(instance), $(UNIVERSAL_STACK_NAME))
make infra/set-stack stack=universal dir=$(DIR_UNIVERSAL)
PYTHONPATH=$(DIR_UNIVERSAL) pulumi up --config-file $(DIR_UNIVERSAL)/Pulumi.$(UNIVERSAL_STACK_NAME).yaml $(BASE_ARGS) $(ARGS)
else ifeq ($(instance), $(INFRA_STACK_NAME))
make infra/set-stack stack=$(INFRA_STACK_NAME)-$(env) dir=$(DIR_INFRA)
PYTHONPATH=$(DIR_INFRA) pulumi up --config-file $(DIR_INFRA)/Pulumi.$(env).yaml $(BASE_ARGS) $(ARGS)
else
make infra/set-stack stack=$(layer)-$(env)-$(instance) dir=$(DIR)
PYTHONPATH=$(DIR) pulumi up --config-file $(DIR)/Pulumi.$(env).yaml $(BASE_ARGS) $(ARGS)
endif
infra/destroy:
ifeq ($(instance), $(UNIVERSAL_STACK_NAME))
make infra/set-stack stack=universal dir=$(DIR_UNIVERSAL)
PYTHONPATH=$(DIR_UNIVERSAL) pulumi destroy --config-file $(DIR_UNIVERSAL)/Pulumi.$(UNIVERSAL_STACK_NAME).yaml $(ARGS)
else ifeq ($(instance), $(INFRA_STACK_NAME))
make infra/set-stack stack=$(INFRA_STACK_NAME)-$(env) dir=$(DIR_INFRA)
PYTHONPATH=$(DIR_INFRA) pulumi destroy --config-file $(DIR_INFRA)/Pulumi.$(env).yaml $(ARGS)
else
make infra/set-stack stack=$(layer)-$(env)-$(instance) dir=$(DIR)
PYTHONPATH=$(DIR) pulumi destroy --config-file $(DIR)/Pulumi.$(env).yaml $(BASE_ARGS) $(ARGS)
endif
test:
pytest -s -vv --disable-warnings
cleanup:
rm -rf ./dist
build:
python3 setup.py sdist
deploy:
$(MAKE) cleanup
$(MAKE) build
twine upload dist/*
release:
@python release.py --operation check
@git checkout ${commit}
@git tag -a "${version}" -m "Release tag for version ${version}"
@git checkout -
@git push origin ${version}
@python release.py --operation create-changelog
@gh release create ${version} -F latest_release_changelog.md
@rm -rf latest_release_changelog.md
create/pipeline:
@python templates/pipeline/engine.py