Today I was setting up a Jenkins pipeline for one of my project and noticed deploy job fails every time it try to execute the script on a remote Linux machine stating the reason – “Build step ‘Execute shell script on remote host using ssh’ marked build as failure”, as follows:
executing script: ./stage-deployment/scripts/stage-node_deploy.sh bash: line 1: ./stage-deployment/scripts/stage-node_deploy.sh: Permission denied [SSH] exit-status: 126 Build step 'Execute shell script on remote host using ssh' marked build as failure
If you are facing the same problem as me then you can fix it after changing the permissions of a directory containing executable, as:
chmod --recursive a+rwx /stage-deployment/scripts/