Display download url for BUILD_PACKAGE action (#22197)

Signed-off-by: stonezdj <stone.zhang@broadcom.com>
This commit is contained in:
stonezdj(Daojun Zhang) 2025-07-23 16:21:10 +08:00 committed by GitHub
parent bb7162f5e6
commit ea4110c30a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 0 deletions

View File

@ -3,7 +3,25 @@ set -x
set -e set -e
function s3_to_https() {
local s3_url="$1"
if [[ "$s3_url" =~ ^s3://([^/]+)/(.+)$ ]]; then
local bucket="${BASH_REMATCH[1]}"
local path="${BASH_REMATCH[2]}"
# current s3 bucket is create in this region
local region="us-west-1"
echo "https://${bucket}.s3.${region}.amazonaws.com/${path}"
else
echo "Invalid S3 URL: $s3_url" >&2
return 1
fi
}
function uploader { function uploader {
converted_url=$(s3_to_https "s3://$2/$1")
echo "download url $converted_url"
aws s3 cp $1 s3://$2/$1 aws s3 cp $1 s3://$2/$1
} }