Skip to content

Commit 0d46617

Browse files
authored
fix: use big part-size option to specify files to upload without chunking (#216)
1 parent f8a2c7a commit 0d46617

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

utils/publish-rpm.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,20 @@ func_repo_clone() {
7373
# ${1} - bucket name
7474
# ${2} - COS path
7575
# ${3} - target path
76-
coscli -e "${VAR_COS_ENDPOINT}" cp -r "cos://${1}/packages/${2}" "${3}"
76+
77+
# --part-size indicates the file chunk size.
78+
# when the file is larger than --part-size, coscli will chunk the file by --part-size.
79+
# when uploading/downloading the file in chunks, it will enable breakpoint transfer by default,
80+
# which will generate cosresumabletask file and interfere with the file integrity.
81+
# ref: https://cloud.tencent.com/document/product/436/63669
82+
coscli -e "${VAR_COS_ENDPOINT}" cp -r --part-size 1000 "cos://${1}/packages/${2}" "${3}"
7783
}
7884

7985
func_repo_backup() {
8086
# ${1} - bucket name
8187
# ${2} - COS path
8288
# ${3} - backup tag
83-
coscli -e "${VAR_COS_ENDPOINT}" cp -r "cos://${1}/packages/${2}" "cos://${1}/packages/backup/${2}_${3}"
89+
coscli -e "${VAR_COS_ENDPOINT}" cp -r --part-size 1000 "cos://${1}/packages/${2}" "cos://${1}/packages/backup/${2}_${3}"
8490
}
8591

8692
func_repo_backup_remove() {
@@ -110,15 +116,15 @@ func_repo_upload() {
110116
# ${2} - bucket name
111117
# ${3} - COS path
112118
coscli -e "${VAR_COS_ENDPOINT}" rm -r -f "cos://${2}/packages/${3}" || true
113-
coscli -e "${VAR_COS_ENDPOINT}" cp -r "${1}" "cos://${2}/packages/${3}"
119+
coscli -e "${VAR_COS_ENDPOINT}" cp -r --part-size 1000 "${1}" "cos://${2}/packages/${3}"
114120
}
115121

116122
func_repo_publish() {
117123
# ${1} - CI bucket
118124
# ${2} - repo publish bucket
119125
# ${3} - COS path
120126
coscli -e "${VAR_COS_ENDPOINT}" rm -r -f "cos://${2}/packages/${3}" || true
121-
coscli -e "${VAR_COS_ENDPOINT}" cp -r "cos://${1}/packages/${3}" "cos://${2}/packages/${3}"
127+
coscli -e "${VAR_COS_ENDPOINT}" cp -r --part-size 1000 "cos://${1}/packages/${3}" "cos://${2}/packages/${3}"
122128
}
123129

124130
# =======================================

0 commit comments

Comments
 (0)