From 094ce5b250f7b1af54b7f08f2b3b353b05946ee4 Mon Sep 17 00:00:00 2001 From: James Slagle Date: Thu, 27 Sep 2018 19:19:13 -0400 Subject: [PATCH] Fail multiple executions of config-download of the same plan Add an initial task to the config_download_deploy workflow that queries for existing executions of the same workflow on the same plan. If any are found, that means that config-download is already running on the existing plan, so we should fail the additional one that is trying to start. Change-Id: I967ae5528834382b6ef69cc4dac10c893c907fc8 --- ...-download-executions-bf1f0984cd8af5f0.yaml | 7 ++++++ workbooks/deployment.yaml | 22 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 releasenotes/notes/fail-multiple-config-download-executions-bf1f0984cd8af5f0.yaml diff --git a/releasenotes/notes/fail-multiple-config-download-executions-bf1f0984cd8af5f0.yaml b/releasenotes/notes/fail-multiple-config-download-executions-bf1f0984cd8af5f0.yaml new file mode 100644 index 000000000..3057f66be --- /dev/null +++ b/releasenotes/notes/fail-multiple-config-download-executions-bf1f0984cd8af5f0.yaml @@ -0,0 +1,7 @@ +--- +other: + - | + Add an initial task to the config_download_deploy workflow that queries for + existing executions of the same workflow on the same plan. If any are + found, that means that config-download is already running on the existing + plan, so the additional one that is trying to start is failed. diff --git a/workbooks/deployment.yaml b/workbooks/deployment.yaml index 8422fa221..140888fbc 100644 --- a/workbooks/deployment.yaml +++ b/workbooks/deployment.yaml @@ -386,6 +386,28 @@ workflows: tasks: + check_for_deploy_in_progress: + action: mistral.executions_find + input: + workflow_name: tripleo.deployment.v1.config_download_deploy + state: RUNNING + publish: + running_config_download_workflows: <% task().result.where($.id != execution().id) %> + on-success: + - fail_deploy_in_progress: <% $.running_config_download_workflows != [] %> + - get_blacklisted_hostnames: <% $.running_config_download_workflows = [] %> + + fail_deploy_in_progress: + workflow: tripleo.messaging.v1.send + input: + queue_name: <% $.queue_name %> + type: <% execution().name %> + status: <% $.get('status', 'FAILED') %> + execution: <% execution() %> + message: Deployment already in progress with execution <% $.running_config_download_workflows[0].id %> + plan_name: <% $.plan_name %> + on-complete: fail + get_blacklisted_hostnames: action: heat.stacks_output_show input: