From 5e553da93889a628609cc4f1ff2d53d0c902e99d Mon Sep 17 00:00:00 2001 From: Sofer Athlan-Guyot Date: Thu, 2 Jul 2020 18:56:07 +0200 Subject: [PATCH] Update, avoid task skipping by directly importing step file. During update we skip a lot tasks because we loop over the same update step task file, changing the step variable, wasting time and clobbering logs. To solve the skipped tasks this, we now loop over the stepX file generated for update and post update. Expanding the playbook to import the tasks and setting the step variable has another benefit. It opens the possibility to use "start-at-tasks" as everything is imported. Using loop variable and include_tasks prevented its usage. Depends-On: https://review.opendev.org/740465 Change-Id: Ib32791d72410766a0b2e2330713120d15dc35f57 --- common/deploy-steps.j2 | 44 +++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/common/deploy-steps.j2 b/common/deploy-steps.j2 index 4b747c1eb6..6d03a525f1 100644 --- a/common/deploy-steps.j2 +++ b/common/deploy-steps.j2 @@ -852,13 +852,6 @@ outputs: external_deploy_steps_tasks: {get_attr: [ExternalDeployTasks, value]} external_post_deploy_steps_tasks: {get_attr: [ExternalPostDeployTasks, value]} - update_steps_tasks: | -{%- for role in roles %} - - include_tasks: {{role.name}}/update_tasks.yaml - when: tripleo_role_name == '{{role.name}}' - tags: - - always -{%- endfor %} update_steps_playbook: {{ self.deploy_steps_str_replace_params() }} template: | @@ -886,33 +879,28 @@ outputs: tripleo_minor_update: true tasks: - import_tasks: hiera_steps_tasks.yaml - - include_tasks: update_steps_tasks.yaml - with_sequence: start=0 end={{update_steps_max-1}} - loop_control: - loop_var: step - tags: - - always - - include_tasks: {{role.name}}/host_prep_tasks.yaml +{%- for step in range(0,update_steps_max) %} + - import_tasks: "{{ role.name }}/update_tasks_step{{ step }}.yaml" + vars: + step: "{{ step }}" +{%- endfor %} + - import_tasks: "{{role.name}}/host_prep_tasks.yaml" when: tripleo_role_name == '{{role.name}}' - tags: - - always - import_tasks: deploy_steps_tasks_step_0.yaml vars: step: 0 - name: Write config data at the start of step 1 import_tasks: common_deploy_steps_tasks_step_1.yaml - - include_tasks: common_deploy_steps_tasks.yaml - with_sequence: start=1 end={{deploy_steps_max-1}} - loop_control: - loop_var: step - tags: - - always - - include_tasks: post_update_steps_tasks.yaml - with_sequence: start=0 end={{post_update_steps_max-1}} - loop_control: - loop_var: step - tags: - - always +{%- for step in range(1,deploy_steps_max) %} + - import_tasks: common_deploy_steps_tasks.yaml + vars: + step: "{{ step }}" +{%- endfor %} +{%- for step in range(0,post_update_steps_max) %} + - import_tasks: "{{ role.name }}/post_update_tasks_step{{ step }}.yaml" + vars: + step: "{{ step }}" +{%- endfor %} {%- endfor %} external_update_steps_tasks: {get_attr: [ExternalUpdateTasks, value]} external_update_steps_playbook: