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:
I have tried to find answers on different forums but none has been exactly useful.
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.
Increase the timeout of SSH server configured in Manage Jenkins settings. Also the exec timeout in job configuration.
relate to Jenkins Text-finder unable to success my Build
configure page
Post Steps
SSH Publishers
Transfers Set
, click advanced
Exec in pty
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With