-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildspec.yaml
52 lines (51 loc) · 2.25 KB
/
buildspec.yaml
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
version: 0.2
phases:
install:
runtime-versions:
nodejs: 14
commands:
- node --version
pre_build:
commands:
- npm install aws-cli-js
- echo "${CODEBUILD_WEBHOOK_TRIGGER}"
- echo "${AWSMarketplaceMeteringRecordsTableName}"
- echo "${EntitlementSNSTopic}"
- echo "${MarketplaceTechAdminEmail}"
- echo "${NewSubscribersTableName}"
- echo "${ProductCode}"
- echo "${SubscriptionSNSTopic}"
- echo "${TypeOfSaaSListing}"
- echo "${WebsiteS3BucketName}"
build:
commands:
- echo Build started
- sam build
- sam package --output-template-file packaged.yaml --s3-bucket saas-artifact-1 --region us-east-1
- |
sam deploy --template-file packaged.yaml --stack-name saas-serverless-${CODEBUILD_BUILD_NUMBER} --capabilities CAPABILITY_IAM \
--region us-east-1 \
--parameter-overrides \
ParameterKey=WebsiteS3BucketName,ParameterValue=${WebsiteS3BucketName}-${CODEBUILD_BUILD_NUMBER} \
ParameterKey=ProductCode,ParameterValue=${ProductCode} \
ParameterKey=EntitlementSNSTopic,ParameterValue=${EntitlementSNSTopic} \
ParameterKey=SubscriptionSNSTopic,ParameterValue=${SubscriptionSNSTopic} \
ParameterKey=AWSMarketplaceMeteringRecordsTableName,ParameterValue=${AWSMarketplaceMeteringRecordsTableName}-${CODEBUILD_BUILD_NUMBER} \
ParameterKey=NewSubscribersTableName,ParameterValue=${NewSubscribersTableName}-${CODEBUILD_BUILD_NUMBER} \
ParameterKey=MarketplaceTechAdminEmail,ParameterValue=${MarketplaceTechAdminEmail} \
ParameterKey=MarketplaceSellerEmail,ParameterValue=${MarketplaceTechAdminEmail}
aws s3 cp ./web/ s3://${WebsiteS3BucketName}-${CODEBUILD_BUILD_NUMBER}/ --recursive
post_build:
commands:
- echo Build completed
- LANDING_PAGE=$(aws cloudformation describe-stacks --stack-name saas-serverless-${CODEBUILD_BUILD_NUMBER} --query "Stacks[0].Outputs[1].OutputValue" --output text --region us-east-1)
- TEST_LANDING_PAGE=$(curl -I -s ${LANDING_PAGE} | head -n 1 | cut -d$' ' -f2)
- echo $TEST_LANDING_PAGE
- |
if [[ "${TEST_LANDING_PAGE}" == "200" ]];
then exit 0;
else exit 1;
fi
artifacts:
files:
- '**/*'