From 1aa68680f46ed3f5899497077785582e11329369 Mon Sep 17 00:00:00 2001 From: flakey5 <73616808+flakey5@users.noreply.github.com> Date: Fri, 8 Nov 2024 09:23:41 +0000 Subject: [PATCH] ansible: use --log-file option for rclone (#3951) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com> Co-authored-by: Michaƫl Zasso --- .../www-standalone/tools/promote/_resha.sh | 28 +++++++++++++++++-- ansible/www-standalone/tools/promote/settings | 4 +++ .../tools/promote/upload_to_cloudflare.sh | 25 +++++++++++++++-- 3 files changed, 51 insertions(+), 6 deletions(-) diff --git a/ansible/www-standalone/tools/promote/_resha.sh b/ansible/www-standalone/tools/promote/_resha.sh index 20e985fff..8016f96fb 100755 --- a/ansible/www-standalone/tools/promote/_resha.sh +++ b/ansible/www-standalone/tools/promote/_resha.sh @@ -34,6 +34,15 @@ if [ -z ${staging_bucket+x} ]; then exit 1 fi +if [ -z ${rclone_log+x} ]; then + echo "\$rclone_log is not set" + exit 1 +fi + +if [ -z ${rclone_log_level+x} ]; then + rclone_log_level=INFO +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 @@ -44,6 +53,19 @@ find "${dstdir}/${version}" -type f -exec chmod 644 '{}' \; find "${dstdir}/${version}" -type d -exec chmod 755 '{}' \; relativedir=${dstdir/$dist_rootdir/"$site/"} -rclone copyto ${dstdir}/index.json $staging_bucket/$relativedir/index.json > /dev/null -rclone copyto ${dstdir}/index.tab $staging_bucket/$relativedir/index.tab > /dev/null -rclone copyto ${dstdir}/${version}/SHASUMS256.txt $staging_bucket/$relativedir/${version}/SHASUMS256.txt > /dev/null +rclone copyto \ + --log-level=${rclone_log_level} \ + --log-file=${rclone_log} \ + ${dstdir}/index.json \ + $staging_bucket/$relativedir/index.json > /dev/null +rclone copyto \ + --log-level=${rclone_log_level} \ + --log-file=${rclone_log} \ + ${dstdir}/index.tab \ + $staging_bucket/$relativedir/index.tab > /dev/null +rclone copyto \ + --log-level=${rclone_log_level} \ + --log-file=${rclone_log} \ + ${dstdir}/${version}/SHASUMS256.txt \ + $staging_bucket/$relativedir/${version}/SHASUMS256.txt > /dev/null + \ No newline at end of file diff --git a/ansible/www-standalone/tools/promote/settings b/ansible/www-standalone/tools/promote/settings index e149fda51..271752268 100755 --- a/ansible/www-standalone/tools/promote/settings +++ b/ansible/www-standalone/tools/promote/settings @@ -39,3 +39,7 @@ chakracore_release_dirmatch=.* prod_bucket=r2:dist-prod staging_bucket=r2:dist-staging + +# format: yyyy-mm-dd-hh-mm-ss.log +rclone_log_level=INFO +rclone_log=/home/dist/rclone/$(date "+%F-%H-%M-%S.log") diff --git a/ansible/www-standalone/tools/promote/upload_to_cloudflare.sh b/ansible/www-standalone/tools/promote/upload_to_cloudflare.sh index b082a70e4..2ce518948 100755 --- a/ansible/www-standalone/tools/promote/upload_to_cloudflare.sh +++ b/ansible/www-standalone/tools/promote/upload_to_cloudflare.sh @@ -30,11 +30,30 @@ if [ -z ${staging_bucket+x} ]; then echo "\$staging_bucket is not set" exit 1 fi +if [ -z ${rclone_log+x} ]; then + echo "\$rlone_log is not set" + exit 1 +fi +if [ -z ${rclone_log_level+x} ]; then + rclone_log_level=INFO +fi relative_srcdir=${srcdir/$staging_rootdir/"$site/"} relative_dstdir=${dstdir/$dist_rootdir/"$site/"} tmpversion=$2 -rclone copy $staging_bucket/$relative_srcdir/$tmpversion/ $prod_bucket/$relative_dstdir/$tmpversion/ -rclone copyto $staging_bucket/$relative_dstdir/index.json $prod_bucket/$relative_dstdir/index.json -rclone copyto $staging_bucket/$relative_dstdir/index.tab $prod_bucket/$relative_dstdir/index.tab +rclone copy \ + --log-level=$rclone_log_level \ + --log-file=$rclone_log \ + $staging_bucket/$relative_srcdir/$tmpversion/ \ + $prod_bucket/$relative_dstdir/$tmpversion/ +rclone copyto \ + --log-level=$rclone_log_level \ + --log-file=$rclone_log \ + $staging_bucket/$relative_dstdir/index.json \ + $prod_bucket/$relative_dstdir/index.json +rclone copyto \ + --log-level=$rclone_log_level \ + --log-file=$rclone_log \ + $staging_bucket/$relative_dstdir/index.tab \ + $prod_bucket/$relative_dstdir/index.tab