From ae84b14bc9b906940c9ce57c1ece4f1c37b202aa Mon Sep 17 00:00:00 2001 From: Erik Auer Date: Fri, 25 Jun 2021 10:38:53 +0200 Subject: [PATCH] Update README.md by adding a failure handler script --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 13eb712..7c73420 100644 --- a/README.md +++ b/README.md @@ -304,6 +304,18 @@ taskApi.updateTask(task) raise Exception("Jenkins job was not built.") ``` +### Using Task Failure Handlers to retry a task x times without an additional releaseVariable + + Define additional action in a [task failure handler](https://docs.xebialabs.com/v.10.1/release/how-to/task-failure-handler/#disabling-the-feature) an use this script to retry the failed task a maximum number of times equal to a defined value. + +``` +MAX_RETRY = 3 + +task = getCurrentTask() +if (task.failuresCount <= MAX_RETRY): + taskApi.retryTask(task.getId(), "Retrying task from failure handler.") +``` + ### Set the release title using release variables ```