krish
krish

Reputation: 369

How to pass a jenkins build after killing the java process on remote host

I've requirement that I need to execute java command java -jar xxxx.jar on a remote host. I am able to run the java job on the remote host. But After sometime I need to kill the java process. So I've created an another job which kills the java PID. It kills the java process on the remote host successfully. But the jenkins job which is running the java jar is failing

[SSH] exit-status: -1
Build step 'Execute shell script on remote host using ssh' marked build as failure
[BFA] Scanning build for known causes...
[BFA] No failure causes found
[BFA] Done. 0s
No previous build found...
Finished: FAILURE

But I'm intentionally killing the java process on the remote host. How can I pass the jenkins build. If anyone have solution, please help me with this situation. Thanks in advance.

Upvotes: 0

Views: 1304

Answers (2)

Agus Prasetiyo
Agus Prasetiyo

Reputation: 1

i had same problem with you, in my case it fixed when i use

java -jar xxxx.jar || if [ $? -ne 1 ]; then true; fi

check if build not returned exit code 1 then it means "true"

Upvotes: 0

richersoon
richersoon

Reputation: 4902

If you want to ignore the error occurred in the remote ssh, you can use || true

java -jar xxxx.jar || true

Upvotes: 0

Related Questions