Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Commit

Permalink
chore(ci): enable s3 versioning only if the stage is prod
Browse files Browse the repository at this point in the history
  • Loading branch information
ishibashi_y committed Jul 5, 2019
1 parent 2be4d0e commit 50f9a82
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ phases:
if [ $? = 0 && "$CODEBUILD_WEBHOOK_TRIGGER" = "branch/release" ]; then
echo 'Deploying to staging environment......'
./node_modules/.bin/sls deploy -s ${stage}
npx sls deploy -s ${stage}
fi
export BUILD_STATUS="$?"
Expand Down
8 changes: 7 additions & 1 deletion serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,8 @@ functions:

# you can add CloudFormation resource templates here
resources:
Conditions:
isProd: {"Fn::Equals" : ["${self:provider.stage}", "prod"]}
Resources:
# APIG
ApiGatewayRestApi:
Expand Down Expand Up @@ -1119,7 +1121,11 @@ resources:
Properties:
BucketName: ${self:custom.STORAGE_NAME}
VersioningConfiguration:
Status: Enabled
Status:
Fn::If:
- isProd
- Enabled
- Suspended
LifecycleConfiguration:
Rules:
- Id: deleteEverythingInOneWeek
Expand Down

0 comments on commit 50f9a82

Please sign in to comment.