-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuildspec.yml
27 lines (25 loc) · 940 Bytes
/
buildspec.yml
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
version: 0.2
##
# These environment variables are injected from codebuild or codepipeline settings.
# - DISTRIBUTION_ID
# - INVALIDATION_PATH
phases:
pre_build:
commands:
- aws --version
- jq --version
- echo "DISTRIBUTION_ID='${DISTRIBUTION_ID}'"
- echo "INVALIDATION_PATH='${INVALIDATION_PATH}'"
build:
commands:
- aws cloudfront create-invalidation --distribution-id "${DISTRIBUTION_ID}" --path "${INVALIDATION_PATH}" | tee response
- INVALIDATION_ID=$(jq -r ".Invalidation.Id" < response)
- |
until [ "${STATUS:=InProgress"}" = "Completed" ]
do
echo "Current status: '${STATUS}' wait 10 seconds."
sleep 10
aws cloudfront get-invalidation --distribution-id "${DISTRIBUTION_ID}" --id "${INVALIDATION_ID}" | tee response
STATUS=$(jq -r ".Invalidation.Status" < response)
done
echo "Current status: '${STATUS}'"