GHA: debug - draft upload of nightly-distributions page

This commit is contained in:
aboyko
2023-09-29 12:27:22 -04:00
parent 1fc7daf3b2
commit 3d214b20d7

View File

@@ -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}" \