Reputation: 974
So I defined a Rundeck job which normally executes three steps:
now I set up the script run on step 1 to finish with exit code 1 when there are no csv files in my remote directory, upon which it does not execute steps 2 and 3 - which is great! But the whole job is marked as having failed
even though it just didn't need to execute the other steps.
Is it possible to conditionally execute steps 2 and 3 of my job such that if step 1 fails it is still marked as 'succeeded'?
Upvotes: 0
Views: 3649
Reputation: 888
It is possible with Rundeck Error Handlers.
You will need to use the job context variable ${result.resultCode}
in your error handler code in order to get a return code.
As you don't want the job marked as failed after the Error Handler was successfully executed, you need to tick Keep going on success
from WebUI or add keepgoingOnSuccess="true"
to you job definition code.
But after the error handler was successfully executed, the job will continue step 2 and step 3, where you may need to inject your step 2 code for it.
Upvotes: 2