Skip to content

Commit 8fc01e0

Browse files
authored
ansible: use rclone instead of aws CLI (#3945)
Use rclone to upload assets to Cloudflare as it is more reliable. Refs: #3508
1 parent 648ff24 commit 8fc01e0

File tree

4 files changed

+12
-81
lines changed

4 files changed

+12
-81
lines changed

ansible/www-standalone/tasks/cloufdflare.yaml

-45
This file was deleted.

ansible/www-standalone/tools/promote/_resha.sh

+3-13
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,6 @@ if [ -z ${staging_bucket+x} ]; then
3434
exit 1
3535
fi
3636

37-
if [ -z ${cloudflare_endpoint+x} ]; then
38-
echo "\$cloudflare_endpoint is not set"
39-
exit 1
40-
fi
41-
42-
if [ -z ${cloudflare_profile+x} ]; then
43-
echo "\$cloudflare_profile is not set"
44-
exit 1
45-
fi
46-
4737
(cd "${dstdir}/${version}" && shasum -a256 $(ls node* openssl* iojs* win-*/* x64/* 2> /dev/null) > SHASUMS256.txt) || exit 1
4838
if [[ $version =~ ^v[0] ]]; then
4939
(cd "${dstdir}/${version}" && shasum $(ls node* openssl* x64/* 2> /dev/null) > SHASUMS.txt) || exit 1
@@ -54,6 +44,6 @@ find "${dstdir}/${version}" -type f -exec chmod 644 '{}' \;
5444
find "${dstdir}/${version}" -type d -exec chmod 755 '{}' \;
5545

5646
relativedir=${dstdir/$dist_rootdir/"$site/"}
57-
aws s3 cp ${dstdir}/index.json $staging_bucket/$relativedir/index.json --endpoint-url=$cloudflare_endpoint --profile $cloudflare_profile > /dev/null
58-
aws s3 cp ${dstdir}/index.tab $staging_bucket/$relativedir/index.tab --endpoint-url=$cloudflare_endpoint --profile $cloudflare_profile > /dev/null
59-
aws s3 cp ${dstdir}/${version}/SHASUMS256.txt $staging_bucket/$relativedir/${version}/SHASUMS256.txt --endpoint-url=$cloudflare_endpoint --profile $cloudflare_profile > /dev/null
47+
rclone copyto ${dstdir}/index.json $staging_bucket/$relativedir/index.json > /dev/null
48+
rclone copyto ${dstdir}/index.tab $staging_bucket/$relativedir/index.tab > /dev/null
49+
rclone copyto ${dstdir}/${version}/SHASUMS256.txt $staging_bucket/$relativedir/${version}/SHASUMS256.txt > /dev/null

ansible/www-standalone/tools/promote/settings

+2-4
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,5 @@ chakracore_release_srcdir=${staging_rootdir}chakracore-release
3737
chakracore_release_dstdir=${dist_rootdir}chakracore-release
3838
chakracore_release_dirmatch=.*
3939

40-
cloudflare_endpoint=https://07be8d2fbc940503ca1be344714cb0d1.r2.cloudflarestorage.com
41-
cloudflare_profile=worker
42-
staging_bucket=s3://dist-staging
43-
dist_bucket=s3://dist-prod
40+
prod_bucket=r2:dist-prod
41+
staging_bucket=r2:dist-staging

ansible/www-standalone/tools/promote/upload_to_cloudflare.sh

+7-19
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,18 @@ if [ -z ${dist_rootdir+x} ]; then
2222
echo "\$dist_rootdir is not set"
2323
exit 1
2424
fi
25-
if [ -z ${staging_bucket+x} ]; then
26-
echo "\$staging_bucket is not set"
27-
exit 1
28-
fi
29-
if [ -z ${dist_bucket+x} ]; then
30-
echo "\$dist_bucket is not set"
25+
if [ -z ${prod_bucket+x} ]; then
26+
echo "\$prod_bucket is not set"
3127
exit 1
3228
fi
33-
if [ -z ${cloudflare_endpoint+x} ]; then
34-
echo "\$cloudflare_endpoint is not set"
35-
exit 1
36-
fi
37-
if [ -z ${cloudflare_profile+x} ]; then
38-
echo "\$cloudflare_profile is not set"
29+
if [ -z ${staging_bucket+x} ]; then
30+
echo "\$staging_bucket is not set"
3931
exit 1
4032
fi
4133

4234
relativedir=${dstdir/$dist_rootdir/"$site/"}
4335
tmpversion=$2
4436

45-
# Due to R2 limitations, `aws s3 cp` and `aws s3 sync` only succeed in copying
46-
# different sets of files across. Fortunately the sets are disjoint, so running
47-
# both commands (ignoring errors) will copy all the files across.
48-
aws s3 cp $staging_bucket/$relativedir/$tmpversion/ $dist_bucket/$relativedir/$tmpversion/ --endpoint-url=$cloudflare_endpoint --profile $cloudflare_profile --recursive --no-follow-symlinks --copy-props none || true
49-
aws s3 sync $staging_bucket/$relativedir/$tmpversion/ $dist_bucket/$relativedir/$tmpversion/ --endpoint-url=$cloudflare_endpoint --profile $cloudflare_profile --no-follow-symlinks || true
50-
aws s3 cp $staging_bucket/$relativedir/index.json $dist_bucket/$relativedir/index.json --endpoint-url=$cloudflare_endpoint --profile $cloudflare_profile
51-
aws s3 cp $staging_bucket/$relativedir/index.tab $dist_bucket/$relativedir/index.tab --endpoint-url=$cloudflare_endpoint --profile $cloudflare_profile
37+
rclone copy $staging_bucket/$relativedir/$tmpversion/ $prod_bucket/$relativedir/$tmpversion/
38+
rclone copyto $staging_bucket/$relativedir/index.json $prod_bucket/$relativedir/index.json
39+
rclone copyto $staging_bucket/$relativedir/index.tab $prod_bucket/$relativedir/index.tab

0 commit comments

Comments
 (0)