forked from base2Services/aws-lambda-port-check
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
27 lines (21 loc) · 1.16 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
CHECK=port-check
BUCKET=my-bucket
STACKNAME=port-check
AWSREGION=ap-southeast-2
COMMIT=$(shell git rev-parse --verify HEAD)
build-image:
echo "docker image not required"
build:
zip "${COMMIT}.zip" "handler.py"
test:
echo "no python unit tests yet"
deploy:
sam package --region ${AWSREGION} --template-file template.yaml --output-template-file packaged.yaml --s3-bucket ${BUCKET}
sam deploy --region ${AWSREGION} --template-file packaged.yaml --stack-name ${STACKNAME}-${COMMIT} --capabilities CAPABILITY_IAM
aws cloudformation wait stack-create-complete --region ${AWSREGION} --stack-name ${STACKNAME}-${COMMIT}
lambda-test:
aws lambda invoke --function-name ${CHECK} --payload file://./test/google.json lambda-test-1.json --log-type Tail --query 'LogResult' --output text | base64 -d
aws lambda invoke --function-name ${CHECK} --payload file://./test/example.json lambda-test-2.json --log-type Tail --query 'LogResult' --output text | base64 -d
if grep -q "errorMessage" lambda-test-*.json; then echo "\nLambda tests failed"; exit 1; else echo "\nLambda tests passed"; fi
destroy:
aws cloudformation delete-stack --region ${AWSREGION} --stack-name ${STACKNAME}-${COMMIT}