Skip to content

Commit 554159b

Browse files
committed
log spac creation errors
1 parent f0c12ed commit 554159b

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

scripts/deploy_to_hf.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -558,12 +558,21 @@ if [ "$PRIVATE" = true ]; then
558558
fi
559559

560560
# create the space if it doesn't exist
561-
hf repo create "$SPACE_REPO" --repo-type space --space_sdk docker --exist-ok $PRIVATE_FLAG ${TOKEN_ARGS[@]+"${TOKEN_ARGS[@]}"} --quiet >/dev/null 2>&1 || true
561+
CREATE_OUTPUT=$(hf repo create "$SPACE_REPO" --repo-type space --space_sdk docker --exist-ok $PRIVATE_FLAG ${TOKEN_ARGS[@]+"${TOKEN_ARGS[@]}"} 2>&1)
562+
CREATE_EXIT_CODE=$?
563+
if [ $CREATE_EXIT_CODE -ne 0 ]; then
564+
echo "⚠️ Space creation returned non-zero exit code" >&2
565+
echo "$CREATE_OUTPUT" >&2
566+
# Continue anyway - space might already exist
567+
fi
562568

563569
# upload the staged content (if repo doesn't exist, it will be created with the privacy setting)
564-
SPACE_UPLOAD_RESULT=$(hf upload --repo-type=space $PRIVATE_FLAG ${TOKEN_ARGS[@]+"${TOKEN_ARGS[@]}"} --quiet "$SPACE_REPO" "$CURRENT_STAGING_DIR_ABS" 2>&1)
565-
if [ $? -ne 0 ]; then
566-
echo "❌ Upload failed: $SPACE_UPLOAD_RESULT" >&2
570+
SPACE_UPLOAD_RESULT=$(hf upload --repo-type=space $PRIVATE_FLAG ${TOKEN_ARGS[@]+"${TOKEN_ARGS[@]}"} "$SPACE_REPO" "$CURRENT_STAGING_DIR_ABS" 2>&1)
571+
UPLOAD_EXIT_CODE=$?
572+
if [ $UPLOAD_EXIT_CODE -ne 0 ]; then
573+
echo "❌ Upload failed with exit code $UPLOAD_EXIT_CODE" >&2
574+
echo "Error output:" >&2
575+
echo "$SPACE_UPLOAD_RESULT" >&2
567576
exit 1
568577
fi
569578
# print the URL of the deployed space

0 commit comments

Comments
 (0)