Skip to content

Commit

Permalink
olares: upload the original file with md5 as a backup (#938)
Browse files Browse the repository at this point in the history
* olares: upload original file with md5 as a backup

* olares: upload original file with md5 as a backup

---------

Co-authored-by: liuyu <>
  • Loading branch information
eball authored Feb 10, 2025
1 parent bb471ba commit 9f32469
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-daily.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Daily Build Release
on:
schedule:
# This is a UTC time
- cron: "30 18 10 2 *"
- cron: "30 18 * * *"
workflow_dispatch:

jobs:
Expand Down
24 changes: 19 additions & 5 deletions scripts/upload-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,28 @@ for deps in "components" "pkgs"; do
name=$(echo -n "$filename"|md5sum|awk '{print $1}')
checksum="$name.checksum.txt"
md5sum $name > $checksum
backup_file=$(cat $checksum)
if [ x"$backup_file" == x"" ]; then
echo "invalid checksum"
exit 1
fi

curl -fsSLI https://dc3p1870nn3cj.cloudfront.net/$path$name > /dev/null
if [ $? -ne 0 ]; then
set -ex
aws s3 cp $name s3://terminus-os-install/$path$name --acl=public-read
aws s3 cp $checksum s3://terminus-os-install/$path$checksum --acl=public-read
echo "upload $name to s3 completed"
set +ex
code=$(curl -o /dev/null -fsSLI -w "%{http_code}" https://dc3p1870nn3cj.cloudfront.net/$path$name.tar.gz)
if [ $code -eq 403 ]; then
set -ex
aws s3 cp $name s3://terminus-os-install/$path$name --acl=public-read
aws s3 cp $name s3://terminus-os-install/backup/$path$backup_file --acl=public-read
aws s3 cp $checksum s3://terminus-os-install/$path$checksum --acl=public-read
echo "upload $name to s3 completed"
set +ex
else
if [ $code -ne 200 ]; then
echo "failed to check image"
exit -1
fi
fi
fi

# upload to tencent cloud cos
Expand Down
74 changes: 51 additions & 23 deletions scripts/upload-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,64 @@ cat $1|while read image; do

curl -fsSLI https://dc3p1870nn3cj.cloudfront.net/$path$name.tar.gz > /dev/null
if [ $? -ne 0 ]; then
set -e
docker pull $image
docker save $image -o $name.tar
gzip $name.tar

md5sum $name.tar.gz > $checksum

aws s3 cp $name.tar.gz s3://terminus-os-install/$path$name.tar.gz --acl=public-read
aws s3 cp $checksum s3://terminus-os-install/$path$checksum --acl=public-read
echo "upload $name completed"

set +e
code=$(curl -o /dev/null -fsSLI -w "%{http_code}" https://dc3p1870nn3cj.cloudfront.net/$path$name.tar.gz)
if [ $code -eq 403 ]; then
set -e
docker pull $image
docker save $image -o $name.tar
gzip $name.tar

md5sum $name.tar.gz > $checksum
backup_file=$(cat $checksum)
if [ x"$backup_file" == x"" ]; then
echo "invalid checksum"
exit 1
fi

aws s3 cp $name.tar.gz s3://terminus-os-install/$path$name.tar.gz --acl=public-read
aws s3 cp $name.tar.gz s3://terminus-os-install/backup/$path$backup_file --acl=public-read
aws s3 cp $checksum s3://terminus-os-install/$path$checksum --acl=public-read
echo "upload $name completed"

set +e
else
if [ $code -ne 200 ]; then
echo "failed to check image"
exit -1
fi
fi
fi



# re-upload checksum.txt
curl -fsSLI https://dc3p1870nn3cj.cloudfront.net/$path$checksum > /dev/null
if [ $? -ne 0 ]; then
set -e
docker pull $image
docker save $image -o $name.tar
gzip $name.tar

md5sum $name.tar.gz > $checksum

aws s3 cp $name.tar.gz s3://terminus-os-install/$path$name.tar.gz --acl=public-read
aws s3 cp $checksum s3://terminus-os-install/$path$checksum --acl=public-read
echo "upload $name completed"
set +e
code=$(curl -o /dev/null -fsSLI -w "%{http_code}" https://dc3p1870nn3cj.cloudfront.net/$path$checksum)
if [ $code -eq 403 ]; then
set -e
docker pull $image
docker save $image -o $name.tar
gzip $name.tar

md5sum $name.tar.gz > $checksum
backup_file=$(cat $checksum)
if [ x"$backup_file" == x"" ]; then
echo "invalid checksum"
exit 1
fi

aws s3 cp $name.tar.gz s3://terminus-os-install/$path$name.tar.gz --acl=public-read
aws s3 cp $name.tar.gz s3://terminus-os-install/backup/$path$backup_file --acl=public-read
aws s3 cp $checksum s3://terminus-os-install/$path$checksum --acl=public-read
echo "upload $name completed"
set +e
else
if [ $code -ne 200 ]; then
echo "failed to check image"
exit -1
fi
fi
fi

# upload to tencent cloud cos
Expand Down

0 comments on commit 9f32469

Please sign in to comment.