SSH Exec does not fail on non-zero exit code
chorniyn opened this issue · comments
Case:
One of the command in the list tries to copy files to the directory where authenticated user does not have write access:
cp *.js TARGET_FOLDER_PATH
Plugin version: 0.5
Expected Result: SSH Exec build step should fail the build.
Problem: SSH Exec build step completes successfully
Real output:
cp: TARGET_FOLDER_PATH/file1.js: Permission denied
cp: TARGET_FOLDER_PATH/file2.js: Permission denied
OUTPUT OF THE NEXT COMMANDS (next commands should not be executed)
I double-checked that exit code of the cp status is 1, but not 0. After I executed this command in shell, this printed "1"
$ exitcode=$?
$ echo $exitcode
Current implementation of SSH Execute sends the command to remote side as a whole, not line-by-line.
As a work around, please use && symbols to combine lines if you want to fail early.
Also, ssh does not return the result of each command to remote side, so there is no way a siingle invocation could keep track of individual commands results.