Job/task Success Status Recovery

16 views
Skip to first unread message

Funkycybermonkey

unread,
Sep 21, 2022, 8:01:03 AM9/21/22
to go-cd
Hello!

I'm curious if anyone is aware of a way to modify the status of a job based on subsequent tasks in that job. For example, in a stage I have a job that if a task fails, I have subsequent tasks that run on failure to correct the cause and automatically rerun the failed task again as a final task in that job. On success can it be triggered to go back to green? Or does it have to be an entire rerun of the job without any failed tasks to be considered a pass?

Ideally the reason for the failure would be corrected but that seems to be a bug in another software I'm calling so a nice short solution would be to do the followup tasks but then have the pipeline keep going if the followup tasks are a success.

I suspect the ability to run a task on failure is solely for cleanup, not recovery but I wanted to see if I was missing something.

Thanks!

Chad Wilson

unread,
Sep 21, 2022, 8:11:05 AM9/21/22
to go...@googlegroups.com
I believe your understanding is correct - that you can't go back and change the earlier task to succeed.


I would consider incorporating your retry/correction steps into the original task with wrapping source controlled scripting, or wrap it with some kind of build automation tooling/task runner that can allow you to model retries or correction hooks so each task is self contained.

Either that, or make the original task return 0 exit code even on failure and have a subsequent task check it succeeded independently and attempt retry if not, with failure if it still fails (although I personally don't think the second approach is that great).

-Chad


--
You received this message because you are subscribed to the Google Groups "go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to go-cd+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/f408b870-c769-49f2-8959-bd633fbe0a8en%40googlegroups.com.

chan...@gmail.com

unread,
Sep 21, 2022, 9:49:47 AM9/21/22
to go...@googlegroups.com

Thanks for the quick response!

 

I was pretty sure that was going to be the answer. I was already rewriting this morning for a try/catch/cleanup/repeat in anticipation of the confirmation. 😃 I agree the second approach would be a last resort but all good suggestions.

 

Thank you!

--
You received this message because you are subscribed to a topic in the Google Groups "go-cd" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/go-cd/xWKXRZncp54/unsubscribe.
To unsubscribe from this group and all its topics, send an email to go-cd+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/CAA1RwH-qQmTNbtLAAZydVruwirebEd1Myi5gNu_aJNRZSPqi0Q%40mail.gmail.com.

Reply all
Reply to author
Forward
0 new messages