-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (38 loc) · 1.56 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
APPNAME := eventbridge-s3-parquet
STAGE ?= dev
BRANCH ?= master
default: clean build lint test
deploy: default deploy-storage deploy-s3-events
include build/go.mk
.PHONY: archive
archive:
@echo "--- build an archive"
@cd dist && zip -X -9 ./handler.zip *-lambda
.PHONY: deploy-storage
deploy-storage:
@echo "--- deploy stack $(APPNAME)-$(STAGE)-$(BRANCH)-storage"
@sam deploy \
--no-fail-on-empty-changeset \
--template-file sam/app/storage.yaml \
--capabilities CAPABILITY_IAM \
--tags "environment=$(STAGE)" "branch=$(BRANCH)" "service=$(APPNAME)" \
--stack-name $(APPNAME)-$(STAGE)-$(BRANCH)-storage \
--parameter-overrides AppName=$(APPNAME) Stage=$(STAGE) Branch=$(BRANCH)
.PHONY: deploy-s3-events
deploy-s3-events:
$(eval SAM_BUCKET := $(shell aws ssm get-parameter --name '/config/$(STAGE)/$(BRANCH)/deploy_bucket' --query 'Parameter.Value' --output text))
$(eval DATA_BUCKET_NAME := $(shell aws ssm get-parameter --name '/config/$(STAGE)/$(BRANCH)/$(APPNAME)/data_bucket_name' --query 'Parameter.Value' --output text))
@sam deploy \
--no-fail-on-empty-changeset \
--template-file sam/app/s3-events.yaml \
--capabilities CAPABILITY_IAM \
--s3-bucket $(SAM_BUCKET) \
--s3-prefix sam/$(GIT_HASH) \
--tags "environment=$(STAGE)" "branch=$(BRANCH)" "service=$(APPNAME)" \
--stack-name $(APPNAME)-$(STAGE)-$(BRANCH)-s3-events \
--parameter-overrides AppName=$(APPNAME) Stage=$(STAGE) Branch=$(BRANCH) \
DataBucketName=$(DATA_BUCKET_NAME)
.PHONY: logs-s3-events
logs-s3-events:
@sam logs \
--stack-name $(APPNAME)-$(STAGE)-$(BRANCH)-s3-events -t