Skip to content

Commit

Permalink
ansible: promote release assets from staging r2 bucket
Browse files Browse the repository at this point in the history
Note: nodejs/node#51394 should land before this does

Reference #3602
  • Loading branch information
flakey5 committed May 6, 2024
1 parent a493573 commit 84fccff
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 6 deletions.
28 changes: 28 additions & 0 deletions ansible/www-standalone/tools/promote/_resha.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ site=$1
dstdir=$2
version=$3

if [ "X${site}" == "X" ]; then
echo "site argument not provided"
exit 1
fi

if [ "X${dstdir}" == "X" ]; then
echo "dstdir argument not provided"
exit 1
Expand All @@ -16,6 +21,26 @@ if [ "X${version}" == "X" ]; then
exit 1
fi

if [ -z ${dist_rootdir+x} ]; then
echo "\$dist_rootdir is not set"
exit 1
fi

if [ -z ${staging_bucket+x} ]; then
echo "\$staging_bucket is not set"
exit 1
fi

if [ -z ${cloudflare_endpoint+x} ]; then
echo "\$cloudflare_endpoint is not set"
exit 1
fi

if [ -z ${cloudflare_profile+x} ]; then
echo "\$cloudflare_profile is not set"
exit 1
fi

(cd "${dstdir}/${version}" && shasum -a256 $(ls node* openssl* iojs* win-*/* x64/* 2> /dev/null) > SHASUMS256.txt) || exit 1
if [[ $version =~ ^v[0] ]]; then
(cd "${dstdir}/${version}" && shasum $(ls node* openssl* x64/* 2> /dev/null) > SHASUMS.txt) || exit 1
Expand All @@ -25,3 +50,6 @@ nodejs-dist-indexer --dist $dstdir --indexjson ${dstdir}/index.json --indextab
find "${dstdir}/${version}" -type f -exec chmod 644 '{}' \;
find "${dstdir}/${version}" -type d -exec chmod 755 '{}' \;

relativedir=${dstdir/$dist_rootdir/"$site/"}
aws s3 cp ${dstdir}/index.json $staging_bucket/$relativedir/index.json --endpoint-url=$cloudflare_endpoint --profile $cloudflare_profile
aws s3 cp ${dstdir}/index.tab $staging_bucket/$relativedir/index.tab --endpoint-url=$cloudflare_endpoint --profile $cloudflare_profile
3 changes: 2 additions & 1 deletion ansible/www-standalone/tools/promote/settings
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ chakracore_release_dirmatch=.*

cloudflare_endpoint=https://07be8d2fbc940503ca1be344714cb0d1.r2.cloudflarestorage.com
cloudflare_profile=worker
destination_bucket=s3://dist-prod
staging_bucket=s3://dist-staging
dist_bucket=s3://dist-prod
14 changes: 9 additions & 5 deletions ansible/www-standalone/tools/promote/upload_to_cloudflare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ if [ -z ${dist_rootdir+x} ]; then
echo "\$dist_rootdir is not set"
exit 1
fi
if [ -z ${destination_bucket+x} ]; then
echo "\$destination_bucket is not set"
if [ -z ${staging_bucket+x} ]; then
echo "\$staging_bucket is not set"
exit 1
fi
if [ -z ${dist_bucket+x} ]; then
echo "\$dist_bucket is not set"
exit 1
fi
if [ -z ${cloudflare_endpoint+x} ]; then
Expand All @@ -38,6 +42,6 @@ fi
relativedir=${dstdir/$dist_rootdir/"$site/"}
tmpversion=$2

aws s3 cp $dstdir/$tmpversion/ $destination_bucket/$relativedir/$tmpversion/ --endpoint-url=$cloudflare_endpoint --profile $cloudflare_profile --recursive --no-follow-symlinks
aws s3 cp $dstdir/index.json $destination_bucket/$relativedir/index.json --endpoint-url=$cloudflare_endpoint --profile $cloudflare_profile
aws s3 cp $dstdir/index.tab $destination_bucket/$relativedir/index.tab --endpoint-url=$cloudflare_endpoint --profile $cloudflare_profile
aws s3 cp $staging_bucket/$relativedir/$tmpversion/ $dist_bucket/$relativedir/$tmpversion/ --endpoint-url=$cloudflare_endpoint --profile $cloudflare_profile --recursive --no-follow-symlinks
aws s3 cp $staging_bucket/$relativedir/index.json $dist_bucket/$relativedir/index.json --endpoint-url=$cloudflare_endpoint --profile $cloudflare_profile
aws s3 cp $staging_bucket/$relativedir/index.tab $dist_bucket/$relativedir/index.tab --endpoint-url=$cloudflare_endpoint --profile $cloudflare_profile

0 comments on commit 84fccff

Please sign in to comment.