From 12f734562c5925c9260a3f038d570a7910c51cfb Mon Sep 17 00:00:00 2001 From: Dougal Matthews Date: Wed, 11 Jan 2017 14:12:44 +0000 Subject: [PATCH] Fail the deployment workflows when sending a "FAILED" message When Mistral workflows execute a second workflow (a sub-workflow execution), the parent workflow can't easily determine if sub-workflow failed. This is because the failure is communicated via a Zaqar message only and when a workflow ends with a successful Zaqar message it appears have been successful. This problem surfaces because parent workflows should have an "on-error" attribute but it is never called, as the workflow doesn't error. This change marks the workflow as failed if the message has the status "FAILED". Now when a sub-workflow fails, the task that called it should have the on-error triggered. Previously it would always go to on-success. Change-Id: Ic1781bcf3922da61d42970cf2b42c951f83f7a74 Related-Bug: #1651704 --- workbooks/deployment.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/workbooks/deployment.yaml b/workbooks/deployment.yaml index b09d80818..09ed24775 100644 --- a/workbooks/deployment.yaml +++ b/workbooks/deployment.yaml @@ -42,6 +42,11 @@ workflows: stdout: <% task(deploy_config).result.deploy_stdout %> stderr: <% task(deploy_config).result.deploy_stderr %> execution: <% execution() %> + on-success: + - fail_workflow: <% $.get('status') = "FAILED" %> + + fail_workflow: + action: std.fail deploy_on_servers: @@ -97,6 +102,10 @@ workflows: status: FAILED message: <% task(deploy_on_servers).result %> execution: <% execution() %> + on-success: fail_workflow + + fail_workflow: + action: std.fail # Deploys a workload cloud stack deploy_plan: @@ -138,3 +147,8 @@ workflows: status: <% $.get('status', 'SUCCESS') %> message: <% $.get('message', '') %> execution: <% execution() %> + on-success: + - fail_workflow: <% $.get('status') = "FAILED" %> + + fail_workflow: + action: std.fail