$ sshpass -p 'password' ssh -t [email protected] 'shell' || true

If the sshpass command returns nonzero ("fails"), you then run and return the 
value of the 'true' program.

--Rob

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Pete Akey
Sent: Tuesday, April 16, 2013 2:31 PM
To: [email protected]
Subject: Can I ask Jenkins to ignore return code?

Hi,

I'm attempting to connect to a remote machine using sshpass.  The script that 
is being run is exiting with "exit 0" but the exit code that is returned to the 
Jenkins "Execute shell" is "255".  I think CLish is making this task 
challenging.

Can I ask Jenkins to accept a return code of 255 for this single job?

Here's a quick example for those who are curious.  The machine has a CLish 
shell.

Connect and drop to bash shell in single command:

$ sshpass -p 'password' ssh -t [email protected] 'shell'
[email protected]:~$ exit 0
exit
Connection to 172.16.5.4 closed.

Back on my machine, check the exit code:

$ echo $?
255

Manually drop to shell on the remote machine with CLish:

$ sshpass -p 'password' ssh [email protected]
CLishPrompt> shell
$ exit
exit
CLishPrompt> exit
Connection to 172.16.5.4 closed.

Check the exit code back on my machine:

$ echo $?
0

I don't know why I am getting an exit status of 255 but I need to issue the 
'shell' command in a single line and am not sure how else to accomplish what 
I'm trying to accomplish in the first example without using 'shell'.  
Therefore, I'd like Jenkins to ignore the fact that the return code is 255 for 
this one job.

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


The information in this message is for the intended recipient(s) only and may 
be the proprietary and/or confidential property of Litle & Co., LLC, and thus 
protected from disclosure. If you are not the intended recipient(s), or an 
employee or agent responsible for delivering this message to the intended 
recipient, you are hereby notified that any use, dissemination, distribution or 
copying of this communication is prohibited. If you have received this 
communication in error, please notify Litle & Co. immediately by replying to 
this message and then promptly deleting it and your reply permanently from your 
computer.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to