File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff 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+
700721invalidate_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}
You can’t perform that action at this time.
0 commit comments