-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
66 lines (48 loc) · 2.23 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
include Makefile.mk
USERNAME=xebia
NAME=cfn-kms-provider
AWS_REGION=eu-central-1
AWS_ACCOUNT=$(shell aws sts get-caller-identity --query Account --output text)
REGISTRY_HOST=$(AWS_ACCOUNT).dkr.ecr.$(AWS_REGION).amazonaws.com
IMAGE=$(REGISTRY_HOST)/$(USERNAME)/$(NAME)
TAG_WITH_LATEST=never
requirements.txt test-requirements.txt: Pipfile.lock
pipenv requirements > requirements.txt
pipenv requirements --dev-only > test-requirements.txt
Pipfile.lock: Pipfile
pipenv update
test: Pipfile.lock
for n in ./cloudformation/*.yaml ; do aws cloudformation validate-template --template-body file://$$n ; done
PYTHONPATH=$(PWD)/src pipenv run pytest ./tests/test*.py
pre-build: requirements.txt
fmt:
black src/*.py tests/*.py
deploy-provider: ## deploy the provider to the current account
sed -i '' -e 's^$(NAME):[0-9]*\.[0-9]*\.[0-9]*[^\.]*^$(NAME):$(VERSION)^' cloudformation/cfn-resource-provider.yaml
aws cloudformation deploy \
--stack-name $(NAME) \
--capabilities CAPABILITY_IAM \
--template-file ./cloudformation/cfn-resource-provider.yaml
delete-provider: ## delete provider from the current account
aws cloudformation delete-stack --stack-name $(NAME)
aws cloudformation wait stack-delete-complete --stack-name $(NAME)
deploy-pipeline: ## deploy the CI/CD pipeline
aws cloudformation deploy \
--stack-name $(NAME)-pipeline \
--capabilities CAPABILITY_IAM \
--template-file ./cloudformation/cicd-pipeline.yaml \
--parameter-overrides Name=$(NAME)
delete-pipeline: ## delete the CI/CD pipeline
aws cloudformation delete-stack --stack-name $(NAME)-pipeline
aws cloudformation wait stack-delete-complete --stack-name $(NAME)-pipeline
demo: ## deploy the demo
aws cloudformation deploy \
--stack-name $(NAME)-demo \
--capabilities CAPABILITY_NAMED_IAM \
--template-file ./cloudformation/demo-stack.yaml
delete-demo: ## delete the demo
aws cloudformation delete-stack --stack-name $(NAME)-demo
aws cloudformation wait stack-delete-complete --stack-name $(NAME)-demo
ecr-login: ## login to the ECR repository
aws ecr get-login-password --region $(AWS_REGION) | \
docker login --username AWS --password-stdin $(REGISTRY_HOST)