Skip to content

Commit 2b868fe

Browse files
kouwesm
authored andcommitted
ARROW-5940: [Release] Add support for re-uploading sign/checksum for binary artifacts
If we fail to upload sign or checksum for a binary artifact, they aren't re-uploaded without this change. Author: Sutou Kouhei <[email protected]> Closes apache#4871 from kou/release-binary-sign-only-reupload and squashes the following commits: fd6f3d484 <Sutou Kouhei> Add support for re-uploading sign/checksum for binary artifacts
1 parent 85f2fb1 commit 2b868fe

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

dev/release/03-binary.sh

+17-6
Original file line numberDiff line numberDiff line change
@@ -248,18 +248,18 @@ sign_and_upload_file() {
248248

249249
local sha256=$(shasum -a 256 ${local_path} | awk '{print $1}')
250250
local download_path=/${BINTRAY_REPOSITORY}/${target}-rc/${upload_path}
251-
if curl \
251+
local source_upload=no
252+
if ! curl \
252253
--fail \
253254
--head \
254255
${BINTRAY_DOWNLOAD_URL_BASE}${download_path} | \
255256
grep -q "^X-Checksum-Sha2: ${sha256}"; then
256-
return 0
257+
upload_file ${version} ${rc} ${target} ${local_path} ${upload_path}
258+
source_upload=yes
257259
fi
258260

259-
upload_file ${version} ${rc} ${target} ${local_path} ${upload_path}
260-
261261
local suffix=
262-
for suffix in asc sha256 sha512; do
262+
for suffix in asc sha512; do
263263
pushd $(dirname ${local_path})
264264
local local_path_base=$(basename ${local_path})
265265
local output_dir=$(mktemp -d -t "arrow-binary-sign.XXXXX")
@@ -278,7 +278,18 @@ sign_and_upload_file() {
278278
${local_path_base} > ${output}
279279
;;
280280
esac
281-
upload_file ${version} ${rc} ${target} ${output} ${upload_path}.${suffix}
281+
local need_upload=no
282+
if [ "${source_upload}" = "yes" ]; then
283+
need_upload=yes
284+
elif ! curl \
285+
--fail \
286+
--head \
287+
${BINTRAY_DOWNLOAD_URL_BASE}${download_path}.${suffix}; then
288+
need_upload=yes
289+
fi
290+
if [ "${need_upload}" = "yes" ]; then
291+
upload_file ${version} ${rc} ${target} ${output} ${upload_path}.${suffix}
292+
fi
282293
rm -rf ${output_dir}
283294
popd
284295
done

0 commit comments

Comments
 (0)