Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to inject custom wait_conditions during stages #1392

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/source/usage/01_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ are shared among multiple roles:
- `cifmw_arch_automation_file`: (String) Name of the workflow automation file
in the architecture repository. Defaults to `default.yaml`
- `cifmw_architecture_scenario`: (String) The selected VA scenario to deploy.
- `cifmw_architecture_wait_condition`: (Dict) Structure defining custom wait_conditions for the automation.
- `cifmw_architecture_user_kustomize`: (Dict) Structure defining user provided kustomization for automation.
- `cifmw_ceph_target`: (String) The Ansible inventory group where ceph is deployed. Defaults to `computes`.
- `cifmw_run_tests`: (Bool) Specifies whether tests should be executed.
Defaults to false.
Expand Down
28 changes: 21 additions & 7 deletions roles/kustomize_deploy/tasks/execute_step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,18 +185,32 @@
ansible.builtin.command:
cmd: "oc apply -f {{ _cr }}"

- name: "Run Wait Conditions for {{ stage.path }}"
- name: "Build Wait Conditions for {{ stage.path }}"
when:
- not cifmw_kustomize_deploy_generate_crs_only | bool
vars:
_stage_name: "stage_{{ stage_id }}"
_custom_conditions: >-
{{
cifmw_architecture_wait_condition[_stage_name] |
default([])
}}
## TODO: remove "validations" once architecture is up-to-date
_commands: >-
{{
(stage['wait_conditions'] |
default(stage['validations'])) + _custom_conditions
}}
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
ansible.builtin.command:
cmd: "{{ wait_condition }}"
## TODO: remove "validations" once architecture is up-to-date
loop: "{{ stage['wait_conditions'] | default(stage['validations']) }}"
loop_control:
loop_var: wait_condition
block:
- name: "Run Wait Conditions for {{ stage.path }}"
ansible.builtin.command:
cmd: "{{ wait_condition }}"
loop: "{{ _commands }}"
loop_control:
loop_var: wait_condition

- name: Stop after applying CRs if requested
when:
Expand Down