Skip to content

Commit 67beb1d

Browse files
kouemkornfield
authored andcommitted
ARROW-5941: [Release] Avoid re-uploading already uploaded binary artifacts
It reduces the number of Bintray API calls and upload time when we retry uploading binary artifacts. Author: Sutou Kouhei <[email protected]> Closes #4872 from kou/release-post-binary-avoid-reupload and squashes the following commits: 0b296e946 <Sutou Kouhei> Avoid re-uploading already uploaded binary artifacts
1 parent f553ad6 commit 67beb1d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

dev/release/post-02-binary.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ fi
4343

4444
: ${BINTRAY_REPOSITORY:=apache/arrow}
4545

46+
BINTRAY_DOWNLOAD_URL_BASE=https://dl.bintray.com
47+
4648
docker_image_name=apache-arrow/release-binary
4749

4850
bintray() {
@@ -100,7 +102,7 @@ download_files() {
100102
--fail \
101103
--location \
102104
--output ${file} \
103-
https://dl.bintray.com/${BINTRAY_REPOSITORY}/${file}
105+
${BINTRAY_DOWNLOAD_URL_BASE}/${BINTRAY_REPOSITORY}/${file}
104106
done
105107
}
106108

@@ -119,6 +121,15 @@ upload_file() {
119121
local path=$3
120122

121123
local sha256=$(shasum -a 256 ${path} | awk '{print $1}')
124+
local download_path=/${BINTRAY_REPOSITORY}/${target}/${path}
125+
if curl \
126+
--fail \
127+
--head \
128+
${BINTRAY_DOWNLOAD_URL_BASE}${download_path} | \
129+
grep -q "^X-Checksum-Sha2: ${sha256}"; then
130+
return 0
131+
fi
132+
122133
local request_path=/content/${BINTRAY_REPOSITORY}/${target}/${version}/${target}/${path}
123134
if ! bintray \
124135
PUT ${request_path} \

0 commit comments

Comments
 (0)