appleboy / appleboy/drone-ssh

Failed script reported as successfully executed

Open
#169 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
314
Forks
79
Avg merge
3m
Merged PRs (30d)
1

Description

I use `drone-ssh` to execute a shell script on a server.

This script has an abort trap and in that case exits with the error code:

```shell
#!/bin/bash
set -eu

abort() {
echo "an error occurred. exiting..."
exit $?
}

trap 'abort' ERR

# do something
```

However, in the case an error occurs it is still being reported as "Successfully executed commands to all host.".
In this particular case it was a git command that failed, not sure if this makes a difference. I assume that the exit code != 0 so I would expect that this is detected as an error.

In the settings I have `script_stop: true`.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the remote shell script failure with script_stop: true and the ERR trap shown in the issue, then trace how drone-ssh receives and evaluates the remote command's exit status. Confirm that a nonzero exit from the failed script is propagated and reported as a failure rather than successful execution.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, shell
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.