-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (42 loc) · 1.3 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
FUNCTION_ALIAS ?= prd
S3_BUCKET_NAME ?= ""
STACK_NAME ?= acm-approver-lamda
DOMAIN_NAME ?= ""
SUBJECT_ALTERNATIVE_NAMES ?= ""
.DEFAULT_GOAL := build
install:
go get gopkg.in/alecthomas/gometalinter.v2
go get github.com/vektra/mockery/.../
gometalinter.v2 --install
go get -t ./cmd/lambda
.PHONY: install
mocks:
go get -u -v github.com/aws/aws-sdk-go/...
mockery -name ACMAPI -dir ../../aws/aws-sdk-go/service/acm/acmiface -recursive
mockery -name Route53API -dir ../../aws/aws-sdk-go/service/route53/route53iface -recursive
mockery -name Certificate -dir pkg/certificate -recursive
.PHONY: mocks
pre_build: install mocks
gometalinter.v2 ./...
go test -v ./...
.PHONY: pre_build
build: pre_build
GOOS=linux GOARCH=amd64 go build -o main ./cmd/lambda
@zip -9 -r ./handler.zip main
.PHONY: build
deploy: build
aws cloudformation package \
--template-file cfn.yaml \
--output-template-file cfn.out.yaml \
--s3-bucket $(S3_BUCKET_NAME) \
--s3-prefix cfn
aws cloudformation deploy \
--template-file cfn.out.yaml \
--capabilities CAPABILITY_IAM \
--stack-name $(STACK_NAME) \
--parameter-overrides \
FunctionAlias=$(FUNCTION_ALIAS) \
FunctionName=$(STACK_NAME) \
DomainName=$(DOMAIN_NAME) \
SubjectAlternativeNames=$(SUBJECT_ALTERNATIVE_NAMES)
.PHONY: deploy