Skip to content

Commit ee6e3f1

Browse files
committed
CF invalidation distro on the way
1 parent 3805c21 commit ee6e3f1

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

bitbucket-pipelines.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -218,27 +218,22 @@ definitions:
218218
name: Find and Invalidate CloudFront Cache
219219
image: amazon/aws-cli
220220
script:
221-
# - aws configure set aws_access_key_id $AWS_ACCESS_CF_KEY_ID
222-
# - aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_CF_KEY
223-
# - aws configure set default.region us-east-1
224221
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_CF_KEY_ID
225222
- export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_CF_KEY
226223
- export AWS_DEFAULT_REGION=$AWS_REGION
227-
- aws sts get-caller-identity
228224
- export CLOUDFRONT_NAME=$(echo "$BITBUCKET_BRANCH" | awk -F'/' '{if(NF==1)val=$1;else if(NF==2)val=$2;else if(NF==3)val=$2;else val=$3;gsub(/_/, "-", val);print tolower(val)}')
229-
- aws cloudfront list-distributions
230225
- export CLOUDFRONT_DISTRIBUTION_ID=$(aws cloudfront list-distributions --query "DistributionList.Items[?Comment=='dev--${CLOUDFRONT_NAME}'].Id" --output text)
231226
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*"
232227

233228
- step: &find-and-invalidate-cloudfront-staging
234229
name: Find and Invalidate CloudFront Cache
235230
image: amazon/aws-cli
236231
script:
237-
- aws configure set aws_access_key_id $AWS_ACCESS_CF_KEY_ID
238-
- aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_CF_KEY
239-
- aws configure set default.region $AWS_REGION
232+
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_CF_KEY_ID
233+
- export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_CF_KEY
234+
- export AWS_DEFAULT_REGION=$AWS_REGION
240235
- export CLOUDFRONT_NAME=$(echo "$BITBUCKET_BRANCH" | awk -F'/' '{if(NF==1)val=$1;else if(NF==2)val=$2;else if(NF==3)val=$2;else val=$3;gsub(/_/, "-", val);print tolower(val)}')
241-
- export CLOUDFRONT_DISTRIBUTION_ID=$(aws cloudfront list-distributions --query "DistributionList.Items[?Comment=='staging--$CLOUDFRONT_NAME'].Id" --output text)
236+
- export CLOUDFRONT_DISTRIBUTION_ID=$(aws cloudfront list-distributions --query "DistributionList.Items[?Comment=='staging--${CLOUDFRONT_NAME}'].Id" --output text)
242237
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*"
243238

244239
pipelines:
@@ -258,8 +253,6 @@ pipelines:
258253
- step: *turn-on-dev
259254
turn-on-staging:
260255
- step: *turn-on-staging
261-
invalidate-cloudfront-dev:
262-
- step: *find-and-invalidate-cloudfront-dev
263256
branches:
264257
'dspace-cris-2024_02_x':
265258
- step: *preliminary-operation

0 commit comments

Comments
 (0)