Skip to content

Commit

Permalink
ansible: use --log-file option for rclone (#3951)
Browse files Browse the repository at this point in the history
Signed-off-by: flakey5 <[email protected]>
Co-authored-by: Michaël Zasso <[email protected]>
  • Loading branch information
flakey5 and targos authored Nov 8, 2024
1 parent 478a534 commit 1aa6868
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 6 deletions.
28 changes: 25 additions & 3 deletions ansible/www-standalone/tools/promote/_resha.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

4 changes: 4 additions & 0 deletions ansible/www-standalone/tools/promote/settings
Original file line number Diff line number Diff line change
Expand Up @@ -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")
25 changes: 22 additions & 3 deletions ansible/www-standalone/tools/promote/upload_to_cloudflare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1aa6868

Please sign in to comment.