Skip to content

Commit b07c8da

Browse files
committed
validate cache issue
1 parent 59e9c20 commit b07c8da

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

master_deploy.sh

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,14 +697,37 @@ deploy_s3bucket() {
697697
done;
698698
}
699699

700+
check_invalidation_status() {
701+
INVALIDATE_ID=$1
702+
counter=0
703+
echo "invalidating cache"
704+
sleep 60
705+
invalidstatus =`aws cloudfront create-invalidation --distribution-id $AWS_CLOUD_FRONT_ID --id $INVALIDATE_ID | $JQ '.Invalidation.Status'`
706+
707+
while [[ $invalidstatus != *"Completed"* ]]
708+
do
709+
echo "Waiting for 15 sec and try to check the invalidation status..."
710+
sleep 15
711+
invalidstatus =`aws cloudfront create-invalidation --distribution-id $AWS_CLOUD_FRONT_ID --id $INVALIDATE_ID | $JQ '.Invalidation.Status'`
712+
counter=`expr $counter + 1`
713+
if [[ $counter -gt $COUNTER_LIMIT ]] ; then
714+
echo "Invalidation does not complete with in 180 seconds. Please check the GUI mode."
715+
exit 1
716+
fi
717+
done
718+
echo "Invalidation completed"
719+
}
720+
700721
invalidate_cf_cache()
701722
{
702723
if [ "$CFCACHE" = "true" ]; then
703724
if [ -z $AWS_CLOUD_FRONT_ID ]; then
704725
echo "Based on header applicaiton has invalidated"
705726
echo "Skipped which is based on AWS cloudfront ID.Kindly raise request to configure cloud front ID in deployment configuration"
706727
else
707-
aws cloudfront create-invalidation --distribution-id $AWS_CLOUD_FRONT_ID --paths '/*'
728+
#aws cloudfront create-invalidation --distribution-id $AWS_CLOUD_FRONT_ID --paths '/*'
729+
INVALIDATE_ID=`aws cloudfront create-invalidation --distribution-id $AWS_CLOUD_FRONT_ID --paths '/*' | $JQ 'Invalidation.Id'`
730+
check_invalidation_status "$INVALIDATE_ID"
708731
fi
709732
fi
710733
}

0 commit comments

Comments
 (0)