GHA: draft upload of nightly-distributions page
This commit is contained in:
66
.github/scripts/clear-s3-caches-pattern.sh
vendored
Executable file
66
.github/scripts/clear-s3-caches-pattern.sh
vendored
Executable file
@@ -0,0 +1,66 @@
|
||||
set -e
|
||||
|
||||
pattern=$1
|
||||
|
||||
echo "Clearing S3 caches for path: ${s3_path}"
|
||||
|
||||
#Flush AWS Cloudfront Cache
|
||||
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}"
|
||||
#invalidation_id=`echo $invalidation_json | jq -r '.Invalidation.Id'`
|
||||
#invalidation_status=`echo $invalidation_json | jq -r '.Invalidation.Status'`
|
||||
#echo "ID=${invalidation_id} Status=${invalidation_status}"
|
||||
#while [ "${invalidation_status}" == "InProgress" ]
|
||||
#do
|
||||
# echo "Invalidation status: ${invalidation_status}"
|
||||
# sleep 3
|
||||
# invalidation_status=`aws cloudfront get-invalidation --distribution-id ECAO9Q8651L8M --id $invalidation_id --output json | jq -r '.Invalidation.Status'`
|
||||
#done
|
||||
#echo "Final invalidation status: ${invalidation_status}"
|
||||
|
||||
# Flush CloudFlare Cache
|
||||
s3_url=s3://dist.springsource.com/
|
||||
files=`aws s3 cp ${s3_url} . --recursive --include "${pattern}" --dryrun`
|
||||
counter=0
|
||||
json=""
|
||||
NL=$'\n'
|
||||
FILES_BATCH=7
|
||||
for file in $files
|
||||
do
|
||||
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" \
|
||||
# -H "X-Auth-Email: spring-sysadmin@pivotal.io" \
|
||||
# -H "Authorization: Bearer ${CLOUDFLARE_CACHE_TOKEN}" \
|
||||
# -H "Content-Type: application/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" \
|
||||
# -H "X-Auth-Email: spring-sysadmin@pivotal.io" \
|
||||
# -H "Authorization: Bearer ${CLOUDFLARE_CACHE_TOKEN}" \
|
||||
# -H "Content-Type: application/json" \
|
||||
# --data "${json}"
|
||||
#fi
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ concurrency:
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
# push:
|
||||
# branches:
|
||||
# - 'main'
|
||||
|
||||
jobs:
|
||||
eclipse-ls-extensions:
|
||||
|
||||
35
.github/workflows/upload-nightly-downloads-page.yml
vendored
Normal file
35
.github/workflows/upload-nightly-downloads-page.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
name: Upload nightly-distributions.html form the Repo to S3
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
||||
upload-nightly-downloads-s3-cache:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
|
||||
with:
|
||||
ref: ${{ inputs.ref }}
|
||||
sparse-checkout: |
|
||||
.github
|
||||
eclipse-distribution/common/html
|
||||
- name: Upload nightly-distributions.html
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.TOOLS_S3_ACCESS_KEY }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.TOOLS_S3_SECRET_KEY }}
|
||||
AWS_DEFAULT_REGION: us-east-1
|
||||
run: |
|
||||
echo "Removing old nightly-distributions.html from s3..."
|
||||
aws s3 rm s3://dist.springsource.com/snapshot/STS4/nightly-distributions.html --dryrun
|
||||
echo "Uploading new nightly-distributions.html to s3..."
|
||||
aws s3 cp ./eclipse-distribution/common/html/nightly-distributions.html s3://dist.springsource.com/snapshot/STS4/nightly-distributions.html --acl public-read --no-progress --dryrun
|
||||
- name: Invalidate S3 Cloudfront Cache
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.TOOLS_S3_ACCESS_KEY }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.TOOLS_S3_SECRET_KEY }}
|
||||
AWS_DEFAULT_REGION: us-east-1
|
||||
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
|
||||
CLOUDFLARE_CACHE_TOKEN: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }}
|
||||
run: |
|
||||
${{ github.workspace }}/.github/scripts/clear-s3-caches-pattern.sh snapshot/STS4/nightly-distributions.html
|
||||
Reference in New Issue
Block a user