Skip to content

Commit 0f5fbb2

Browse files
committed
Fix hook scp error handling - show copy failures
Remove silent failure mode for hook script transfers: - Pre-deploy hook: Error if scp fails (deployment stops) - Post-deploy hook: Warn if scp fails (deployment continues) - Show actual scp error output instead of hiding it - Helps diagnose permission/connection issues during copy
1 parent 43dc48b commit 0f5fbb2

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

lib/release.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ run_pre_deploy_hook() {
135135
info "Running pre-deploy hook: $hook_script"
136136

137137
# Copy hook script to release directory
138-
scp -P "$SSH_PORT" "$hook_script" "$SSH_USER@$SSH_HOST:$release_path/.shipnode-pre-deploy.sh" > /dev/null 2>&1
138+
if ! scp -P "$SSH_PORT" "$hook_script" "$SSH_USER@$SSH_HOST:$release_path/.shipnode-pre-deploy.sh" 2>&1; then
139+
error "Failed to copy pre-deploy hook to server"
140+
fi
139141

140142
# Execute hook on remote server
141143
local result
@@ -186,7 +188,10 @@ run_post_deploy_hook() {
186188
info "Running post-deploy hook: $hook_script"
187189

188190
# Copy hook script to current directory
189-
scp -P "$SSH_PORT" "$hook_script" "$SSH_USER@$SSH_HOST:$current_path/.shipnode-post-deploy.sh" > /dev/null 2>&1
191+
if ! scp -P "$SSH_PORT" "$hook_script" "$SSH_USER@$SSH_HOST:$current_path/.shipnode-post-deploy.sh" 2>&1; then
192+
warn "Failed to copy post-deploy hook to server"
193+
return 1
194+
fi
190195

191196
# Execute hook on remote server
192197
local result

0 commit comments

Comments
 (0)