Skip to content

Commit b3c7c9e

Browse files
committed
[SPARK-52241][BUILD][FOLLOW-UP] Make it fail if one of the curls fails
### What changes were proposed in this pull request? This PR is a followup of #50965 that fails if one of the curls fails. ### Why are the changes needed? This is a regression in the release script. We should make it failed if one of the uploads fails. ### Does this PR introduce _any_ user-facing change? No, dev-only. ### How was this patch tested? Manually tested. ### Was this patch authored or co-authored using generative AI tooling? No Closes #50968 from HyukjinKwon/SPARK-52241-followup. Authored-by: Hyukjin Kwon <[email protected]> Signed-off-by: Hyukjin Kwon <[email protected]>
1 parent 11090d5 commit b3c7c9e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

dev/create-release/release-build.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,19 +563,35 @@ if [[ "$1" == "publish-release" ]]; then
563563
if ! is_dry_run; then
564564
nexus_upload=$NEXUS_ROOT/deployByRepositoryId/$staged_repo_id
565565
echo "Uploading files to $nexus_upload"
566+
567+
# Temp file to track errors
568+
error_flag_file=$(mktemp)
569+
566570
find . -type f | sed -e 's|^\./||' | \
567571
xargs -P 8 -n 1 -I {} bash -c '
568572
file_short="{}"
569573
dest_url="'$NEXUS_ROOT'/deployByRepositoryId/'$staged_repo_id'/org/apache/spark/$file_short"
570574
echo "[START] $file_short"
575+
571576
if curl --retry 3 --retry-all-errors -sS -u "$ASF_USERNAME:$ASF_PASSWORD" \
572577
--upload-file "$file_short" "$dest_url"; then
573578
echo "[ OK ] $file_short"
574579
else
575580
echo "[FAIL ] $file_short"
581+
echo "fail" >> '"$error_flag_file"'
576582
fi
577583
'
578584

585+
# Check if any failures were recorded
586+
if [ -s "$error_flag_file" ]; then
587+
echo "One or more uploads failed."
588+
rm "$error_flag_file"
589+
exit 1
590+
else
591+
echo "All uploads succeeded."
592+
rm "$error_flag_file"
593+
fi
594+
579595
echo "Closing nexus staging repository"
580596
repo_request="<promoteRequest><data><stagedRepositoryId>$staged_repo_id</stagedRepositoryId><description>Apache Spark $SPARK_VERSION (commit $git_hash)</description></data></promoteRequest>"
581597
out=$(curl -X POST -d "$repo_request" -u $ASF_USERNAME:$ASF_PASSWORD \

0 commit comments

Comments
 (0)