Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ansible: fix promotion to R2 dist-prod for releases #3840

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ansible/www-standalone/tools/promote/resha_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ fi

${__dirname}/_resha.sh $site $dstdir $2

. ${__dirname}/upload_to_cloudflare.sh $site $2
# https://github.com/nodejs/build/issues/3508
# Output from upload_to_cloudflare.sh must not go to stdout to prevent
# breaking the release.sh script.
logfile="${__dirname}/logs/cloudflare.log"
date >> "${logfile}"
. ${__dirname}/upload_to_cloudflare.sh $site $2 >> "${logfile}" 2>&1

/home/nodejs/queue-cdn-purge.sh $site resha_release
6 changes: 5 additions & 1 deletion ansible/www-standalone/tools/promote/upload_to_cloudflare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ fi
relativedir=${dstdir/$dist_rootdir/"$site/"}
tmpversion=$2

aws s3 cp $staging_bucket/$relativedir/$tmpversion/ $dist_bucket/$relativedir/$tmpversion/ --endpoint-url=$cloudflare_endpoint --profile $cloudflare_profile --recursive --no-follow-symlinks
# Due to R2 limitations, `aws s3 cp` and `aws s3 sync` only succeed in copying
# different sets of files across. Fortunately the sets are disjoint, so running
# both commands (ignoring errors) will copy all the files across.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of scope of this PR, but I wonder if it would be worth switching to rclone for moving files around like this? I've found it to be reliable across different S3 providers (rclone has various workarounds for different S3 providers.)

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
aws s3 sync $staging_bucket/$relativedir/$tmpversion/ $dist_bucket/$relativedir/$tmpversion/ --endpoint-url=$cloudflare_endpoint --profile $cloudflare_profile --no-follow-symlinks || true
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