GHA: debug - draft upload of nightly-distributions page
This commit is contained in:
@@ -1,19 +1,10 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
pattern=$1
|
file=$1
|
||||||
if [ -z "$2" ];
|
echo "Clearing S3 caches for file: ${file}"
|
||||||
then
|
|
||||||
echo "undefined"
|
|
||||||
path_with_pattern=$pattern
|
|
||||||
else
|
|
||||||
echo "defined"
|
|
||||||
dir=$2
|
|
||||||
path_with_pattern="${dir}/${pattern}"
|
|
||||||
fi
|
|
||||||
echo "Clearing S3 caches for path: ${path_with_pattern}"
|
|
||||||
|
|
||||||
#Flush AWS Cloudfront Cache
|
#Flush AWS Cloudfront Cache
|
||||||
echo "aws cloudfront create-invalidation --distribution-id ECAO9Q8651L8M --output json --paths '${path_with_pattern}'"
|
echo "aws cloudfront create-invalidation --distribution-id ECAO9Q8651L8M --output json --paths '${file}'"
|
||||||
|
|
||||||
#invalidation_json=`aws cloudfront create-invalidation --distribution-id ECAO9Q8651L8M --output json --paths "${path_with_pattern}"`
|
#invalidation_json=`aws cloudfront create-invalidation --distribution-id ECAO9Q8651L8M --output json --paths "${path_with_pattern}"`
|
||||||
#echo "Invalidation response: ${invalidation_json}"
|
#echo "Invalidation response: ${invalidation_json}"
|
||||||
@@ -29,48 +20,14 @@ echo "aws cloudfront create-invalidation --distribution-id ECAO9Q8651L8M --outpu
|
|||||||
#echo "Final invalidation status: ${invalidation_status}"
|
#echo "Final invalidation status: ${invalidation_status}"
|
||||||
|
|
||||||
# Flush CloudFlare Cache
|
# Flush CloudFlare Cache
|
||||||
if [ -z "$dir" ];
|
json="{\"files\": [ \"s3://dist.springsource.com/${file}\" ] }"
|
||||||
then
|
echo $json
|
||||||
s3_url="s3://dist.springsource.com/"
|
|
||||||
else
|
|
||||||
s3_url="s3://dist.springsource.com/${dir}/"
|
|
||||||
fi
|
|
||||||
echo "aws s3 cp ${s3_url} . --recursive --include '${pattern}' --dryrun"
|
|
||||||
files=`aws s3 cp ${s3_url} . --recursive --include "${pattern}" --dryrun`
|
|
||||||
counter=0
|
|
||||||
json=""
|
|
||||||
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}"
|
|
||||||
fi
|
|
||||||
if [[ "$counter" -eq "$FILES_BATCH" ]]; then
|
|
||||||
json="${json%,*}${NL}]}"
|
|
||||||
echo $json
|
|
||||||
|
|
||||||
# curl -X DELETE "https://api.cloudflare.com/client/v4/zones/${CLOUDFLARE_ZONE_ID}/purge_cache" \
|
# curl -X DELETE "https://api.cloudflare.com/client/v4/zones/${CLOUDFLARE_ZONE_ID}/purge_cache" \
|
||||||
# -H "X-Auth-Email: spring-sysadmin@pivotal.io" \
|
# -H "X-Auth-Email: spring-sysadmin@pivotal.io" \
|
||||||
# -H "Authorization: Bearer ${CLOUDFLARE_CACHE_TOKEN}" \
|
# -H "Authorization: Bearer ${CLOUDFLARE_CACHE_TOKEN}" \
|
||||||
# -H "Content-Type: application/json" \
|
# -H "Content-Type: application/json" \
|
||||||
# --data "${json}"
|
# --data "${json}"
|
||||||
|
|
||||||
json=""
|
|
||||||
counter=0
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
#if ! [[ "$counter" -eq 0 ]]; then
|
|
||||||
# json="${json%,*}${NL}]}"
|
|
||||||
# echo $json
|
|
||||||
#
|
|
||||||
# curl -X DELETE "https://api.cloudflare.com/client/v4/zones/${CLOUDFLARE_ZONE_ID}/purge_cache" \
|
# curl -X DELETE "https://api.cloudflare.com/client/v4/zones/${CLOUDFLARE_ZONE_ID}/purge_cache" \
|
||||||
# -H "X-Auth-Email: spring-sysadmin@pivotal.io" \
|
# -H "X-Auth-Email: spring-sysadmin@pivotal.io" \
|
||||||
# -H "Authorization: Bearer ${CLOUDFLARE_CACHE_TOKEN}" \
|
# -H "Authorization: Bearer ${CLOUDFLARE_CACHE_TOKEN}" \
|
||||||
@@ -32,4 +32,4 @@ jobs:
|
|||||||
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
|
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
|
||||||
CLOUDFLARE_CACHE_TOKEN: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }}
|
CLOUDFLARE_CACHE_TOKEN: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
${{ github.workspace }}/.github/scripts/clear-s3-caches-pattern.sh nightly-distributions.html snapshot/STS4
|
${{ github.workspace }}/.github/scripts/clear-s3-caches-file.sh snapshot/STS4/nightly-distributions.html
|
||||||
|
|||||||
Reference in New Issue
Block a user