Problem: Jenkins job fails with
remote file operation failed error. This error was caused while running shell block in the Jenkinsfile groovy script.
If this error occurs, the following are the remediation steps that you could use.
Restart the slave agent
Login to the slave box and stop the slave service.
ps -ef | grep slave.jar
get the process id of the slave and kill it.
kill -9 <process-id>
launch the agent again from the master.
90% of the time, restarting the agent should solve this issue.
Make sure you have enough access writes to the location you are trying to manipulate a file.
Make use you are using the right java versions required by the job.