Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exception when publishing, exception message [Exec timed out or was interrupted after .. ms]

I need to create a Jenkins job that runs a PowerShell script on another server over SSH. I am using 'Send files or execute commands over SSH' option to do the needful. The 'Exec command' field has value "cmd /c XCopy.bat" where XCopy.bat (batch file present on the other server - Windows server 2008 R2 - where my SSH is installed) in turns runs the PowerShell. The job is simply to copy a folder and its content to another location.

When I build the job, the copying is done as desired. However, the job terminates in Unstable build. Here are the logs:

SSH: Connecting from host [USVAUJNKW001]
SSH: Connecting with configuration [54.254.146.206-SGSGDAPPW001] ...
SSH: EXEC: STDOUT/STDERR from command [cmd /c XCopy.bat] ...
**copy job done**
SSH: Disconnecting configuration [54.254.146.206-SGSGDAPPW001] ...
ERROR: Exception when publishing, exception message [Exec timed out or was interrupted after 120,012 ms]
Build step 'Send files or execute commands over SSH' changed build result to UNSTABLE
Finished: UNSTABLE

I have tried different 'Exec timeout (ms)' values and (un)checked 'Exec in pty' but to no success.

Queries:

  1. Is there any other option in Jenkins through which I can accomplish the task i.e. to simply run a PS script on another server via SSH.
  2. How could I be using the current option incorrectly?
  3. Do I need to make changes, if any, at batch/PS file level to return some code that tells the Jenkins that job is complete and it should exit successfully?

I have tried to find answers on different forums but none has been exactly useful.

like image 956
Chitra Belwal Avatar asked Dec 15 '14 05:12

Chitra Belwal


3 Answers

This issue can be resolved by changing the Job configuration. When using Send Files or execute commands over SSH

Click on Advanced Tab.

Set Execution Timeout(ms): 0

This will help you in avoiding the timeout exception. It has worked for me, so hopefully it will work for you too. Exec timeout (ms) set to 0

like image 69
Shivam Chandra Avatar answered Sep 19 '22 14:09

Shivam Chandra


Increase the timeout of SSH server configured in Manage Jenkins settings. Also the exec timeout in job configuration.

like image 35
Shashi Ranjan Avatar answered Sep 20 '22 14:09

Shashi Ranjan


relate to Jenkins Text-finder unable to success my Build

enter image description here

  1. Into your job's configure page
  2. Roll down and In Post Steps SSH Publishers
  3. In Transfers Set, click advanced
  4. checked Exec in pty
like image 40
山鬼谣 Avatar answered Sep 21 '22 14:09

山鬼谣