-
Notifications
You must be signed in to change notification settings - Fork 77
/
buildspec.yaml
60 lines (60 loc) · 2.65 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
53
54
55
56
57
58
59
60
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 "${MarketplaceTechAdminEmail}"
- echo "${NewSubscribersTableName}"
- echo "${ProductId}"
- echo "${TypeOfSaaSListing}"
- echo "${WebsiteS3BucketName}"
- echo "${SNSAccountID}"
- echo "${SNSRegion}"
- echo "${CreateCrossAccountRole}"
- echo "${CrossAccountId}"
- echo "${CrossAccountRoleName}"
- echo "${CreateRegistrationWebPage}"
- echo "${UpdateFulfillmentURL}"
build:
commands:
- echo Build started
- sam build
- |
sam deploy --stack-name saas-serverless-${CODEBUILD_BUILD_NUMBER} --s3-bucket saas-artifact-1 --capabilities CAPABILITY_NAMED_IAM \
--region us-east-1 \
--parameter-overrides \
ParameterKey=WebsiteS3BucketName,ParameterValue=${WebsiteS3BucketName}-${CODEBUILD_BUILD_NUMBER} \
ParameterKey=NewSubscribersTableName,ParameterValue=${NewSubscribersTableName}-${CODEBUILD_BUILD_NUMBER} \
ParameterKey=AWSMarketplaceMeteringRecordsTableName,ParameterValue=${AWSMarketplaceMeteringRecordsTableName}-${CODEBUILD_BUILD_NUMBER} \
ParameterKey=ProductId,ParameterValue=${ProductId} \
ParameterKey=MarketplaceTechAdminEmail,ParameterValue=${MarketplaceTechAdminEmail} \
ParameterKey=MarketplaceSellerEmail,ParameterValue=${MarketplaceTechAdminEmail} \
ParameterKey=SNSAccountID,ParameterValue=${SNSAccountID} \
ParameterKey=SNSRegion,ParameterValue=${SNSRegion} \
ParameterKey=CreateCrossAccountRole,ParameterValue=${CreateCrossAccountRole} \
ParameterKey=CrossAccountId,ParameterValue=${CrossAccountId} \
ParameterKey=CrossAccountRoleName,ParameterValue=${CrossAccountRoleName}-${CODEBUILD_BUILD_NUMBER} \
ParameterKey=CreateRegistrationWebPage,ParameterValue=${CreateRegistrationWebPage} \
ParameterKey=UpdateFulfillmentURL,ParameterValue=${UpdateFulfillmentURL}
post_build:
commands:
- echo Build completed
- LANDING_PAGE=$(aws cloudformation describe-stacks --stack-name saas-serverless-${CODEBUILD_BUILD_NUMBER} --query "Stacks[0].Outputs[0].OutputValue" --output text --region us-east-1)
- echo $LANDING_PAGE
- 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:
- '**/*'