-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
114 lines (87 loc) · 2.66 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
guard-%:
@ if [ "${${*}}" = "" ]; then \
echo "Environment variable $* not set"; \
exit 1; \
fi
# install targets
install: install-python install-hooks install-node
install-python:
poetry install
install-node:
npm ci
install-hooks: install-python
poetry run pre-commit install --install-hooks --overwrite
# lint targets
lint: lint-samtemplates lint-python lint-githubactions lint-githubaction-scripts
lint-python:
poetry run flake8 scripts/*.py --config .flake8
lint-samtemplates:
poetry run cfn-lint -t SAMtemplates/*.yaml
lint-githubactions:
actionlint
lint-githubaction-scripts:
shellcheck .github/scripts/*.sh
# test targets
test: download-dependencies
mvn test
check-licenses: check-licenses-python check-licenses-java
check-licenses-python:
scripts/check_python_licenses.sh
check-licenses-java:
mvn validate
show-unused-dependencies:
mvn dependency:analyze
# clean targets
clean-packages:
rm -f src/main/resources/package/*.tgz
clean: clean-packages
rm -rf target
mvn clean
rm -rf .aws-sam
deep-clean: clean
rm -rf .venv
rm -rf .idea
rm -rf .mvn
rm -rf src/main/main.iml
rm -rf src/test/test.iml
# build targets
compile: download-dependencies
mvn package
download-dependencies:
poetry run scripts/download_dependencies.py
# SAM targets
sam-validate:
sam validate --template-file SAMtemplates/main_template.yaml --region eu-west-2
sam validate --template-file SAMtemplates/lambda_resources.yaml --region eu-west-2
sam-build: sam-validate download-dependencies
sam build --template-file SAMtemplates/main_template.yaml --region eu-west-2
sam-sync: guard-AWS_DEFAULT_PROFILE guard-stack_name download-dependencies
sam sync \
--stack-name $$stack_name \
--watch \
--template-file SAMtemplates/main_template.yaml
sam-deploy-package: guard-artifact_bucket guard-artifact_bucket_prefix guard-stack_name guard-template_file guard-cloud_formation_execution_role guard-LOG_LEVEL guard-LOG_RETENTION_DAYS
sam deploy \
--template-file $$template_file \
--stack-name $$stack_name \
--capabilities CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND \
--region eu-west-2 \
--s3-bucket $$artifact_bucket \
--s3-prefix $$artifact_bucket_prefix \
--config-file samconfig_package_and_deploy.toml \
--no-fail-on-empty-changeset \
--role-arn $$cloud_formation_execution_role \
--no-confirm-changeset \
--force-upload \
--tags "version=$$VERSION_NUMBER" \
--parameter-overrides \
EnableSplunk=true \
LogLevel=$$LOG_LEVEL \
LogRetentionDays=$$LOG_RETENTION_DAYS \
EnableAlerts=$$ENABLE_ALERTS
aws-configure:
aws configure sso --region eu-west-2
aws-login:
aws sso login --sso-session sso-session
cfn-guard:
./scripts/run_cfn_guard.sh