File tree 1 file changed +24
-1
lines changed 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -697,14 +697,37 @@ deploy_s3bucket() {
697
697
done ;
698
698
}
699
699
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
+
700
721
invalidate_cf_cache ()
701
722
{
702
723
if [ " $CFCACHE " = " true" ]; then
703
724
if [ -z $AWS_CLOUD_FRONT_ID ]; then
704
725
echo " Based on header applicaiton has invalidated"
705
726
echo " Skipped which is based on AWS cloudfront ID.Kindly raise request to configure cloud front ID in deployment configuration"
706
727
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 "
708
731
fi
709
732
fi
710
733
}
You can’t perform that action at this time.
0 commit comments