From 3d214b20d71a2d8f38c4785ca2637fe3f8899c2a Mon Sep 17 00:00:00 2001 From: aboyko Date: Fri, 29 Sep 2023 12:27:22 -0400 Subject: [PATCH] GHA: debug - draft upload of nightly-distributions page --- .github/scripts/clear-s3-caches-pattern.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/scripts/clear-s3-caches-pattern.sh b/.github/scripts/clear-s3-caches-pattern.sh index 7ba02e761..3fcdf71c0 100755 --- a/.github/scripts/clear-s3-caches-pattern.sh +++ b/.github/scripts/clear-s3-caches-pattern.sh @@ -2,10 +2,10 @@ set -e pattern=$1 -echo "Clearing S3 caches for path: ${s3_path}" +echo "Clearing S3 caches for path: ${pattern}" #Flush AWS Cloudfront Cache -echo 'aws cloudfront create-invalidation --distribution-id ECAO9Q8651L8M --output json --paths "/${pattern}"' +echo "aws cloudfront create-invalidation --distribution-id ECAO9Q8651L8M --output json --paths '/${pattern}'" #invalidation_json=`aws cloudfront create-invalidation --distribution-id ECAO9Q8651L8M --output json --paths "/${pattern}"` #echo "Invalidation response: ${invalidation_json}" @@ -22,6 +22,7 @@ echo 'aws cloudfront create-invalidation --distribution-id ECAO9Q8651L8M --outpu # Flush CloudFlare Cache s3_url=s3://dist.springsource.com/ +echo "aws s3 cp ${s3_url} . --recursive --include '${pattern}' --dryrun" files=`aws s3 cp ${s3_url} . --recursive --include "${pattern}" --dryrun` counter=0 json="" @@ -29,19 +30,20 @@ NL=$'\n' FILES_BATCH=7 for file in $files do + echo "Looking at ${file}" if [[ "$counter" -eq 0 ]]; then json="{\"files\": [${NL}" fi if [[ "$file" =~ ^"s3://dist.springsource.com" ]]; then echo "Processing ${file}" counter=$((counter+1)) -# path=${file:26} -# json="${json}\"http://dist.springsource.com${path}\",${NL}\"https://dist.springsource.com${path}\",${NL}\"http://download.springsource.com${path}\",${NL}\"https://download.springsource.com${path}\",${NL}" + path=${file:26} + json="${json}\"http://dist.springsource.com${path}\",${NL}\"https://dist.springsource.com${path}\",${NL}\"http://download.springsource.com${path}\",${NL}\"https://download.springsource.com${path}\",${NL}" fi if [[ "$counter" -eq "$FILES_BATCH" ]]; then -# json="${json%,*}${NL}]}" -# echo $json -# + json="${json%,*}${NL}]}" + echo $json + # curl -X DELETE "https://api.cloudflare.com/client/v4/zones/${CLOUDFLARE_ZONE_ID}/purge_cache" \ # -H "X-Auth-Email: spring-sysadmin@pivotal.io" \ # -H "Authorization: Bearer ${CLOUDFLARE_CACHE_TOKEN}" \