-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathMakefile
71 lines (53 loc) · 2.61 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
include Makefile.mk
USERNAME=xebia
NAME=cfn-secret-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
Pipfile.lock: Pipfile requirements.txt test-requirements.txt
requirements.txt test-requirements.txt: Pipfile
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 \
--capabilities CAPABILITY_IAM \
--stack-name $(NAME) \
--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 \
--capabilities CAPABILITY_IAM \
--stack-name $(NAME)-pipeline \
--template-file ./cloudformation/cicd-pipeline.yaml
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 \
--template-file ./cloudformation/demo-stack.yaml --capabilities CAPABILITY_NAMED_IAM \
--parameter-overrides \
ApiKey=$(shell ./encrypt-secret CD98BD30-F944-4FD9-B86D-3F67664FBAEB);
docker build -t $(NAME)-demo --build-arg STACK_NAME=$(NAME)-demo -f Dockerfile.demo .
docker run -v $(HOME)/.aws:/root/.aws \
-e AWS_REGION=$(shell aws configure get region) \
-e AWS_PROFILE=$${AWS_PROFILE:-default} \
$(NAME)-demo
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)