From 70f81c8f28b19b3c57905b1f86e2855f1d856d76 Mon Sep 17 00:00:00 2001 From: Amartya Sinha Date: Wed, 22 Oct 2025 15:34:27 +0530 Subject: [PATCH] Use group_vars in ci/playbooks: cifmw_project_dir & cifmw_project_dir_absolute Since Zuul is not upgraded, we will have to do the workaround to read group_vars in ci/playbooks executed by Zuul executor. This commit tries to do so. Signed-off-by: Amartya Sinha --- ci/playbooks/architecture/run.yml | 14 +++++++- ci/playbooks/bootstrap-networking-mapper.yml | 14 +++++++- ci/playbooks/build_push_container_runner.yml | 14 +++++++- ci/playbooks/content_provider/pre.yml | 12 ++++--- ci/playbooks/content_provider/run.yml | 16 ++++++++-- ci/playbooks/e2e-collect-logs.yml | 16 ++++++++-- ci/playbooks/e2e-prepare.yml | 28 +++++++++++++--- ci/playbooks/e2e-run.yml | 20 +++++++++--- ci/playbooks/edpm/run.yml | 16 ++++++++-- ci/playbooks/edpm/update.yml | 14 +++++++- .../edpm_baremetal_deployment/run.yml | 14 +++++++- ...dpm_build_images_content_provider_run.yaml | 18 +++++++++-- ci/playbooks/edpm_build_images/run.yml | 16 ++++++++-- .../kuttl/kuttl-from-operator-deps.yaml | 14 +++++++- .../kuttl/kuttl-from-operator-run.yaml | 14 +++++++- ci/playbooks/kuttl/run.yml | 14 +++++++- ci/playbooks/meta_content_provider/run.yml | 16 ++++++++-- ci/playbooks/molecule-prepare.yml | 16 ++++++++-- ci/playbooks/pod-jobs.yml | 32 +++++++++++++++---- ci/playbooks/tcib/run.yml | 14 +++++++- ci/playbooks/test-base-job/test-run.yml | 16 ++++++++-- 21 files changed, 301 insertions(+), 47 deletions(-) diff --git a/ci/playbooks/architecture/run.yml b/ci/playbooks/architecture/run.yml index 0b45fd5cd..2903fe8da 100644 --- a/ci/playbooks/architecture/run.yml +++ b/ci/playbooks/architecture/run.yml @@ -3,6 +3,18 @@ hosts: "{{ cifmw_zuul_target_host | default('all') }}" gather_facts: true tasks: + # FIXME(amsinha/danpawlik): Current version of zuul does not support include-vars [1] from file, + # thus using this hack to read files. Will replace all these hacky var file read with include-vars + # once Zuul is upgraded. + # [1] https://zuul-ci.org/docs/zuul/latest/config/job.html#attr-job.include-vars + - name: Read group_vars + vars: + provided_dir: > + {{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/group_vars + ansible.builtin.include_role: + name: cifmw_helpers + tasks_from: var_dir.yml + - name: Filter out host if needed when: - cifmw_zuul_target_host is defined @@ -12,7 +24,7 @@ - name: Run playbook ansible.builtin.command: - chdir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework" + chdir: "{{ cifmw_project_dir_absolute }}" cmd: >- ansible-playbook -i localhost, -c local ci/playbooks/architecture/validate-architecture.yml diff --git a/ci/playbooks/bootstrap-networking-mapper.yml b/ci/playbooks/bootstrap-networking-mapper.yml index 5d91e085a..78b626241 100644 --- a/ci/playbooks/bootstrap-networking-mapper.yml +++ b/ci/playbooks/bootstrap-networking-mapper.yml @@ -3,6 +3,18 @@ hosts: controller gather_facts: true tasks: + # FIXME(amsinha/danpawlik): Current version of zuul does not support include-vars [1] from file, + # thus using this hack to read files. Will replace all these hacky var file read with include-vars + # once Zuul is upgraded. + # [1] https://zuul-ci.org/docs/zuul/latest/config/job.html#attr-job.include-vars + - name: Read group_vars + vars: + provided_dir: > + {{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/group_vars + ansible.builtin.include_role: + name: cifmw_helpers + tasks_from: var_dir.yml + - name: Create a networking_mapper playbook ansible.builtin.copy: dest: "{{ ansible_user_dir }}/networking_mapper.yml" @@ -17,7 +29,7 @@ environment: ANSIBLE_HOST_KEY_CHECKING: false ansible.builtin.command: - chdir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework" + chdir: "{{ cifmw_project_dir_absolute }}" cmd: >- ~/test-python/bin/ansible-playbook {{ ansible_user_dir }}/networking_mapper.yml -i {{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml diff --git a/ci/playbooks/build_push_container_runner.yml b/ci/playbooks/build_push_container_runner.yml index 957c24808..ace89750a 100644 --- a/ci/playbooks/build_push_container_runner.yml +++ b/ci/playbooks/build_push_container_runner.yml @@ -2,9 +2,21 @@ - name: Run build_push_container role hosts: "{{ cifmw_zuul_target_host | default('controller') }}" tasks: + # FIXME(amsinha/danpawlik): Current version of zuul does not support include-vars [1] from file, + # thus using this hack to read files. Will replace all these hacky var file read with include-vars + # once Zuul is upgraded. + # [1] https://zuul-ci.org/docs/zuul/latest/config/job.html#attr-job.include-vars + - name: Read group_vars + vars: + provided_dir: > + {{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/group_vars + ansible.builtin.include_role: + name: cifmw_helpers + tasks_from: var_dir.yml + - name: Run build_push_container role vars: - ci_framework_src_dir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework" + ci_framework_src_dir: "{{ cifmw_project_dir_absolute }}" ansible.builtin.command: chdir: "{{ ci_framework_src_dir }}" cmd: >- diff --git a/ci/playbooks/content_provider/pre.yml b/ci/playbooks/content_provider/pre.yml index 35aa5f712..3438de5d5 100644 --- a/ci/playbooks/content_provider/pre.yml +++ b/ci/playbooks/content_provider/pre.yml @@ -1,4 +1,12 @@ --- +- name: Get all repos on all hosts + hosts: all + gather_facts: true + tasks: + - name: Clone repos in the job workspace + ansible.builtin.include_role: + name: prepare-workspace + - name: "Run ci/playbooks/content_provider/pre.yml" hosts: "{{ cifmw_zuul_target_host | default('all') }}" tasks: @@ -9,10 +17,6 @@ - inventory_hostname != cifmw_zuul_target_host ansible.builtin.meta: end_host - - name: Clone repos in the job workspace - ansible.builtin.include_role: - name: prepare-workspace - - name: Install ansible-core become: true ansible.builtin.package: diff --git a/ci/playbooks/content_provider/run.yml b/ci/playbooks/content_provider/run.yml index 81788f7e0..dabb3eebb 100644 --- a/ci/playbooks/content_provider/run.yml +++ b/ci/playbooks/content_provider/run.yml @@ -3,6 +3,18 @@ hosts: "{{ cifmw_zuul_target_host | default('all') }}" gather_facts: true tasks: + # FIXME(amsinha/danpawlik): Current version of zuul does not support include-vars [1] from file, + # thus using this hack to read files. Will replace all these hacky var file read with include-vars + # once Zuul is upgraded. + # [1] https://zuul-ci.org/docs/zuul/latest/config/job.html#attr-job.include-vars + - name: Read group_vars + vars: + provided_dir: > + {{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/group_vars + ansible.builtin.include_role: + name: cifmw_helpers + tasks_from: var_dir.yml + - name: Filter out host if needed when: - cifmw_zuul_target_host is defined @@ -12,9 +24,9 @@ - name: Deploy content provider environment: - ANSIBLE_CONFIG: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/ansible.cfg" + ANSIBLE_CONFIG: "{{ cifmw_project_dir_absolute }}/ansible.cfg" ansible.builtin.command: - chdir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework" + chdir: "{{ cifmw_project_dir_absolute }}" cmd: >- ansible-playbook -i localhost, -c local ci/playbooks/content_provider/content_provider.yml diff --git a/ci/playbooks/e2e-collect-logs.yml b/ci/playbooks/e2e-collect-logs.yml index a1719a31a..939eed3c2 100644 --- a/ci/playbooks/e2e-collect-logs.yml +++ b/ci/playbooks/e2e-collect-logs.yml @@ -3,6 +3,18 @@ hosts: "{{ cifmw_zuul_target_host | default('all') }}" gather_facts: true tasks: + # FIXME(amsinha/danpawlik): Current version of zuul does not support include-vars [1] from file, + # thus using this hack to read files. Will replace all these hacky var file read with include-vars + # once Zuul is upgraded. + # [1] https://zuul-ci.org/docs/zuul/latest/config/job.html#attr-job.include-vars + - name: Read group_vars + vars: + provided_dir: > + {{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/group_vars + ansible.builtin.include_role: + name: cifmw_helpers + tasks_from: var_dir.yml + - name: Filter out host if needed when: - cifmw_zuul_target_host is defined @@ -13,7 +25,7 @@ - name: Ensure we have the ci-framework on host register: cifmw_status ansible.builtin.stat: - path: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework" + path: "{{ cifmw_project_dir_absolute }}" - name: End host if no basedir when: @@ -35,7 +47,7 @@ tasks_from: run_logs.yml tags: - logs - environment: + environment: ANSIBLE_LOG_PATH: "{{ ansible_user_dir }}/ci-framework-data/logs/e2e-collect-logs-must-gather.log" - name: "Run ci/playbooks/e2e-collect-logs.yml on CRC host" diff --git a/ci/playbooks/e2e-prepare.yml b/ci/playbooks/e2e-prepare.yml index fdc8588ad..e07b0b4e8 100644 --- a/ci/playbooks/e2e-prepare.yml +++ b/ci/playbooks/e2e-prepare.yml @@ -1,12 +1,28 @@ --- -- name: "Run ci/playbooks/e2e-prepare.yml" - hosts: controller, primary +- name: Get all repos on all hosts + hosts: all gather_facts: true tasks: - name: Clone repos in the job workspace ansible.builtin.include_role: name: prepare-workspace +- name: "Run ci/playbooks/e2e-prepare.yml" + hosts: controller, primary + gather_facts: true + tasks: + # FIXME(amsinha/danpawlik): Current version of zuul does not support include-vars [1] from file, + # thus using this hack to read files. Will replace all these hacky var file read with include-vars + # once Zuul is upgraded. + # [1] https://zuul-ci.org/docs/zuul/latest/config/job.html#attr-job.include-vars + - name: Read group_vars + vars: + provided_dir: > + {{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/group_vars + ansible.builtin.include_role: + name: cifmw_helpers + tasks_from: var_dir.yml + - name: Create zuul-output directory ansible.builtin.file: path: "{{ ansible_user_dir }}/zuul-output/logs" @@ -26,9 +42,13 @@ ansible.builtin.command: cmd: pip --version + - name: DNM Print dir + ansible.builtin.debug: + msg: "proj dir is {{ cifmw_project_dir_absolute }}" + - name: Install requirements community.general.make: - chdir: "{{ ansible_user_dir }}/{{ zuul.projects['github.com/openstack-k8s-operators/ci-framework'].src_dir }}" + chdir: "{{ cifmw_project_dir_absolute }}" target: setup_molecule - name: Add cronjob to trigger job stats @@ -37,7 +57,7 @@ minute: "*" job: >- /usr/bin/date >> /tmp/crio-stats.log; - {{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/scripts/get-stats.sh >> + {{ cifmw_project_dir_absolute }}/scripts/get-stats.sh >> /tmp/crio-stats.log when: cifmw_openshift_crio_stats | default(false) diff --git a/ci/playbooks/e2e-run.yml b/ci/playbooks/e2e-run.yml index ebcc50d85..816d3dea5 100644 --- a/ci/playbooks/e2e-run.yml +++ b/ci/playbooks/e2e-run.yml @@ -2,12 +2,22 @@ - name: "Run ci/playbooks/e2e-run.yml" hosts: "{{ cifmw_zuul_target_host | default('controller') }}" gather_facts: true - vars: - ci_framework_src_dir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework" tasks: + # FIXME(amsinha/danpawlik): Current version of zuul does not support include-vars [1] from file, + # thus using this hack to read files. Will replace all these hacky var file read with include-vars + # once Zuul is upgraded. + # [1] https://zuul-ci.org/docs/zuul/latest/config/job.html#attr-job.include-vars + - name: Read group_vars + vars: + provided_dir: > + {{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/group_vars + ansible.builtin.include_role: + name: cifmw_helpers + tasks_from: var_dir.yml + - name: Tagged packages ansible.builtin.command: - chdir: "{{ ci_framework_src_dir }}" + chdir: "{{ cifmw_project_dir_absolute }}" cmd: >- ansible-playbook deploy-edpm.yml -i "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml" @@ -28,7 +38,7 @@ - name: Tagged bootstrap - no packages ansible.builtin.command: - chdir: "{{ ci_framework_src_dir }}" + chdir: "{{ cifmw_project_dir_absolute }}" cmd: >- ansible-playbook deploy-edpm.yml -i "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml" @@ -50,7 +60,7 @@ - name: Not tagged bootstrap nor packages ansible.builtin.command: - chdir: "{{ ci_framework_src_dir }}" + chdir: "{{ cifmw_project_dir_absolute }}" cmd: >- ansible-playbook deploy-edpm.yml -i "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml" diff --git a/ci/playbooks/edpm/run.yml b/ci/playbooks/edpm/run.yml index e49364271..c4965835c 100644 --- a/ci/playbooks/edpm/run.yml +++ b/ci/playbooks/edpm/run.yml @@ -3,6 +3,18 @@ hosts: "{{ cifmw_zuul_target_host | default('all') }}" gather_facts: true tasks: + # FIXME(amsinha/danpawlik): Current version of zuul does not support include-vars [1] from file, + # thus using this hack to read files. Will replace all these hacky var file read with include-vars + # once Zuul is upgraded. + # [1] https://zuul-ci.org/docs/zuul/latest/config/job.html#attr-job.include-vars + - name: Read group_vars + vars: + provided_dir: > + {{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/group_vars + ansible.builtin.include_role: + name: cifmw_helpers + tasks_from: var_dir.yml + - name: Filter out host if needed when: - cifmw_zuul_target_host is defined @@ -24,7 +36,7 @@ - name: Run Podified EDPM deployment ansible.builtin.command: - chdir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework" + chdir: "{{ cifmw_project_dir_absolute }}" cmd: >- ansible-playbook deploy-edpm.yml -i "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml" @@ -42,7 +54,7 @@ - name: Run Podified EDPM post deployment ansible.builtin.command: - chdir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework" + chdir: "{{ cifmw_project_dir_absolute }}" cmd: >- ansible-playbook post-deployment.yml -i "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml" diff --git a/ci/playbooks/edpm/update.yml b/ci/playbooks/edpm/update.yml index cc663f7cc..79308ee42 100644 --- a/ci/playbooks/edpm/update.yml +++ b/ci/playbooks/edpm/update.yml @@ -3,6 +3,18 @@ hosts: "{{ cifmw_zuul_target_host | default('all') }}" gather_facts: true tasks: + # FIXME(amsinha/danpawlik): Current version of zuul does not support include-vars [1] from file, + # thus using this hack to read files. Will replace all these hacky var file read with include-vars + # once Zuul is upgraded. + # [1] https://zuul-ci.org/docs/zuul/latest/config/job.html#attr-job.include-vars + - name: Read group_vars + vars: + provided_dir: > + {{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/group_vars + ansible.builtin.include_role: + name: cifmw_helpers + tasks_from: var_dir.yml + - name: Filter out host if needed when: - cifmw_zuul_target_host is defined @@ -17,7 +29,7 @@ - name: Run Podified EDPM update ansible.builtin.command: - chdir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework" + chdir: "{{ cifmw_project_dir_absolute }}" cmd: >- ansible-playbook update-edpm.yml -i "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml" diff --git a/ci/playbooks/edpm_baremetal_deployment/run.yml b/ci/playbooks/edpm_baremetal_deployment/run.yml index ed388ed08..b39793646 100644 --- a/ci/playbooks/edpm_baremetal_deployment/run.yml +++ b/ci/playbooks/edpm_baremetal_deployment/run.yml @@ -3,6 +3,18 @@ hosts: "{{ cifmw_zuul_target_host | default('all') }}" gather_facts: true tasks: + # FIXME(amsinha/danpawlik): Current version of zuul does not support include-vars [1] from file, + # thus using this hack to read files. Will replace all these hacky var file read with include-vars + # once Zuul is upgraded. + # [1] https://zuul-ci.org/docs/zuul/latest/config/job.html#attr-job.include-vars + - name: Read group_vars + vars: + provided_dir: > + {{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/group_vars + ansible.builtin.include_role: + name: cifmw_helpers + tasks_from: var_dir.yml + - name: Filter out host if needed when: - cifmw_zuul_target_host is defined @@ -55,7 +67,7 @@ - name: Perform Podified and EDPM deployment on compute nodes with virtual baremetal ansible.builtin.command: - chdir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework" + chdir: "{{ cifmw_project_dir_absolute }}" cmd: >- ansible-playbook deploy-edpm.yml -i "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml" diff --git a/ci/playbooks/edpm_build_images/edpm_build_images_content_provider_run.yaml b/ci/playbooks/edpm_build_images/edpm_build_images_content_provider_run.yaml index 0d6f2e62b..62e5f957b 100644 --- a/ci/playbooks/edpm_build_images/edpm_build_images_content_provider_run.yaml +++ b/ci/playbooks/edpm_build_images/edpm_build_images_content_provider_run.yaml @@ -1,8 +1,20 @@ --- - name: "Run ci/playbooks/edpm_build_images/edpm_build_images_content_provider_run.yaml" - hosts: "{{ cifmw_zuul_target_host | default('all') }}" + hosts: "{{ cifmw_zuul_target_host | default('all') }}" gather_facts: true tasks: + # FIXME(amsinha/danpawlik): Current version of zuul does not support include-vars [1] from file, + # thus using this hack to read files. Will replace all these hacky var file read with include-vars + # once Zuul is upgraded. + # [1] https://zuul-ci.org/docs/zuul/latest/config/job.html#attr-job.include-vars + - name: Read group_vars + vars: + provided_dir: > + {{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/group_vars + ansible.builtin.include_role: + name: cifmw_helpers + tasks_from: var_dir.yml + - name: Filter out host if needed when: - cifmw_zuul_target_host is defined @@ -12,9 +24,9 @@ - name: Build edpm images environment: - ANSIBLE_CONFIG: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/ansible.cfg" + ANSIBLE_CONFIG: "{{ cifmw_project_dir_absolute }}/ansible.cfg" ansible.builtin.command: - chdir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework" + chdir: "{{ cifmw_project_dir_absolute }}" cmd: >- ansible-playbook -i localhost, -c local ci/playbooks/edpm_build_images/edpm_build_images_content_provider.yaml diff --git a/ci/playbooks/edpm_build_images/run.yml b/ci/playbooks/edpm_build_images/run.yml index 2d1b0aef7..4a6ccfc23 100644 --- a/ci/playbooks/edpm_build_images/run.yml +++ b/ci/playbooks/edpm_build_images/run.yml @@ -3,6 +3,18 @@ hosts: "{{ cifmw_zuul_target_host | default('all') }}" gather_facts: true tasks: + # FIXME(amsinha/danpawlik): Current version of zuul does not support include-vars [1] from file, + # thus using this hack to read files. Will replace all these hacky var file read with include-vars + # once Zuul is upgraded. + # [1] https://zuul-ci.org/docs/zuul/latest/config/job.html#attr-job.include-vars + - name: Read group_vars + vars: + provided_dir: > + {{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/group_vars + ansible.builtin.include_role: + name: cifmw_helpers + tasks_from: var_dir.yml + - name: Filter out host if needed when: - cifmw_zuul_target_host is defined @@ -12,9 +24,9 @@ - name: Run EDPM build image environment: - ANSIBLE_CONFIG: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/ansible.cfg" + ANSIBLE_CONFIG: "{{ cifmw_project_dir_absolute }}/ansible.cfg" ansible.builtin.command: - chdir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework" + chdir: "{{ cifmw_project_dir_absolute }}" cmd: >- ansible-playbook -i {{ cifmw_zuul_target_host }}, -c local ci/playbooks/edpm_build_images/edpm_image_builder.yml diff --git a/ci/playbooks/kuttl/kuttl-from-operator-deps.yaml b/ci/playbooks/kuttl/kuttl-from-operator-deps.yaml index e34c79062..75f8a6bb9 100644 --- a/ci/playbooks/kuttl/kuttl-from-operator-deps.yaml +++ b/ci/playbooks/kuttl/kuttl-from-operator-deps.yaml @@ -2,9 +2,21 @@ hosts: controller gather_facts: true tasks: + # FIXME(amsinha/danpawlik): Current version of zuul does not support include-vars [1] from file, + # thus using this hack to read files. Will replace all these hacky var file read with include-vars + # once Zuul is upgraded. + # [1] https://zuul-ci.org/docs/zuul/latest/config/job.html#attr-job.include-vars + - name: Read group_vars + vars: + provided_dir: > + {{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/group_vars + ansible.builtin.include_role: + name: cifmw_helpers + tasks_from: var_dir.yml + - name: Run kuttl deploy-deps playbook ansible.builtin.command: - chdir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework" + chdir: "{{ cifmw_project_dir_absolute }}" cmd: >- ansible-playbook ci/playbooks/kuttl/deploy-deps.yaml -i "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml" diff --git a/ci/playbooks/kuttl/kuttl-from-operator-run.yaml b/ci/playbooks/kuttl/kuttl-from-operator-run.yaml index dc5d376d8..18cf095cf 100644 --- a/ci/playbooks/kuttl/kuttl-from-operator-run.yaml +++ b/ci/playbooks/kuttl/kuttl-from-operator-run.yaml @@ -2,9 +2,21 @@ hosts: controller gather_facts: true tasks: + # FIXME(amsinha/danpawlik): Current version of zuul does not support include-vars [1] from file, + # thus using this hack to read files. Will replace all these hacky var file read with include-vars + # once Zuul is upgraded. + # [1] https://zuul-ci.org/docs/zuul/latest/config/job.html#attr-job.include-vars + - name: Read group_vars + vars: + provided_dir: > + {{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/group_vars + ansible.builtin.include_role: + name: cifmw_helpers + tasks_from: var_dir.yml + - name: Run kuttl tests from operator playbook ansible.builtin.command: - chdir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework" + chdir: "{{ cifmw_project_dir_absolute }}" cmd: >- ansible-playbook ci/playbooks/kuttl/run-kuttl-from-operator-targets.yaml -i "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml" diff --git a/ci/playbooks/kuttl/run.yml b/ci/playbooks/kuttl/run.yml index bc13b6ab5..f6e221564 100644 --- a/ci/playbooks/kuttl/run.yml +++ b/ci/playbooks/kuttl/run.yml @@ -2,9 +2,21 @@ hosts: controller gather_facts: true tasks: + # FIXME(amsinha/danpawlik): Current version of zuul does not support include-vars [1] from file, + # thus using this hack to read files. Will replace all these hacky var file read with include-vars + # once Zuul is upgraded. + # [1] https://zuul-ci.org/docs/zuul/latest/config/job.html#attr-job.include-vars + - name: Read group_vars + vars: + provided_dir: > + {{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/group_vars + ansible.builtin.include_role: + name: cifmw_helpers + tasks_from: var_dir.yml + - name: Run kuttl tests playbook ansible.builtin.command: - chdir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework" + chdir: "{{ cifmw_project_dir_absolute }}" cmd: >- ansible-playbook ci/playbooks/kuttl/e2e-kuttl.yml -i "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml" diff --git a/ci/playbooks/meta_content_provider/run.yml b/ci/playbooks/meta_content_provider/run.yml index 965a447c4..a0c019b76 100644 --- a/ci/playbooks/meta_content_provider/run.yml +++ b/ci/playbooks/meta_content_provider/run.yml @@ -3,6 +3,18 @@ hosts: "{{ cifmw_zuul_target_host | default('all') }}" gather_facts: true tasks: + # FIXME(amsinha/danpawlik): Current version of zuul does not support include-vars [1] from file, + # thus using this hack to read files. Will replace all these hacky var file read with include-vars + # once Zuul is upgraded. + # [1] https://zuul-ci.org/docs/zuul/latest/config/job.html#attr-job.include-vars + - name: Read group_vars + vars: + provided_dir: > + {{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/group_vars + ansible.builtin.include_role: + name: cifmw_helpers + tasks_from: var_dir.yml + - name: Filter out host if needed when: - cifmw_zuul_target_host is defined @@ -12,9 +24,9 @@ - name: Deploy Meta content provider environment: - ANSIBLE_CONFIG: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/ansible.cfg" + ANSIBLE_CONFIG: "{{ cifmw_project_dir_absolute }}/ansible.cfg" ansible.builtin.command: - chdir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework" + chdir: "{{ cifmw_project_dir_absolute }}" cmd: >- ansible-playbook ci/playbooks/meta_content_provider/meta_content_provider.yml -i "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml" diff --git a/ci/playbooks/molecule-prepare.yml b/ci/playbooks/molecule-prepare.yml index 4650fc981..c9a1132e0 100644 --- a/ci/playbooks/molecule-prepare.yml +++ b/ci/playbooks/molecule-prepare.yml @@ -3,6 +3,18 @@ hosts: "{{ cifmw_zuul_target_host | default('controller') }}" gather_facts: true tasks: + # FIXME(amsinha/danpawlik): Current version of zuul does not support include-vars [1] from file, + # thus using this hack to read files. Will replace all these hacky var file read with include-vars + # once Zuul is upgraded. + # [1] https://zuul-ci.org/docs/zuul/latest/config/job.html#attr-job.include-vars + - name: Read group_vars + vars: + provided_dir: > + {{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/group_vars + ansible.builtin.include_role: + name: cifmw_helpers + tasks_from: var_dir.yml + - name: Execute mirror info role to configure /etc/ci/mirror_info.sh vars: mirror_fqdn: "mirror.{{ nodepool.region | lower }}.{{ nodepool.cloud | lower }}.rdoproject.org" @@ -32,8 +44,6 @@ - python3-pip - name: Install venv - vars: - src_dir: "{{ zuul.projects['github.com/openstack-k8s-operators/ci-framework'].src_dir }}" community.general.make: - chdir: "{{ ansible_user_dir }}/{{ src_dir }}" + chdir: "{{ cifmw_project_dir_absolute }}" target: setup_molecule diff --git a/ci/playbooks/pod-jobs.yml b/ci/playbooks/pod-jobs.yml index a9cb1f653..733dee481 100644 --- a/ci/playbooks/pod-jobs.yml +++ b/ci/playbooks/pod-jobs.yml @@ -2,6 +2,18 @@ - name: Run light checks in pod hosts: all tasks: + # FIXME(amsinha/danpawlik): Current version of zuul does not support include-vars [1] from file, + # thus using this hack to read files. Will replace all these hacky var file read with include-vars + # once Zuul is upgraded. + # [1] https://zuul-ci.org/docs/zuul/latest/config/job.html#attr-job.include-vars + - name: Read group_vars + vars: + provided_dir: > + {{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/group_vars + ansible.builtin.include_role: + name: cifmw_helpers + tasks_from: var_dir.yml + - name: Install packages become: true ansible.builtin.package: @@ -16,17 +28,23 @@ state: directory mode: "0755" + - name: Create workdir directory + ansible.builtin.file: + path: "{{ cifmw_project_dir_absolute | dirname }}" + state: directory + + - name: Create symlink for project dir + ansible.builtin.file: + src: "/workspace/{{ cifmw_project_dir }}" + dest: "{{ cifmw_project_dir_absolute }}" + state: link + - name: Run make targets - vars: - src_dir: >- - {{ - zuul.projects['github.com/openstack-k8s-operators/ci-framework'].src_dir - }} block: - name: Install dependencies register: _setup community.general.make: - chdir: "{{ src_dir }}" + chdir: "{{ cifmw_project_dir_absolute }}" target: setup_molecule params: USE_VENV: "no" @@ -36,7 +54,7 @@ - name: Run check community.general.make: - chdir: "{{ src_dir }}" + chdir: "{{ cifmw_project_dir_absolute }}" target: "{{ run_test }}" params: USE_VENV: "no" diff --git a/ci/playbooks/tcib/run.yml b/ci/playbooks/tcib/run.yml index 0d97f918a..056beff65 100644 --- a/ci/playbooks/tcib/run.yml +++ b/ci/playbooks/tcib/run.yml @@ -3,6 +3,18 @@ hosts: "{{ cifmw_zuul_target_host | default('all') }}" gather_facts: true tasks: + # FIXME(amsinha/danpawlik): Current version of zuul does not support include-vars [1] from file, + # thus using this hack to read files. Will replace all these hacky var file read with include-vars + # once Zuul is upgraded. + # [1] https://zuul-ci.org/docs/zuul/latest/config/job.html#attr-job.include-vars + - name: Read group_vars + vars: + provided_dir: > + {{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/group_vars + ansible.builtin.include_role: + name: cifmw_helpers + tasks_from: var_dir.yml + - name: Filter out host if needed when: - cifmw_zuul_target_host is defined @@ -19,7 +31,7 @@ - name: Run tcib playbook ansible.builtin.command: - chdir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework" + chdir: "{{ cifmw_project_dir_absolute }}" cmd: >- ansible-playbook ci/playbooks/tcib/tcib.yml -i "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml" diff --git a/ci/playbooks/test-base-job/test-run.yml b/ci/playbooks/test-base-job/test-run.yml index a31454645..23a89d672 100644 --- a/ci/playbooks/test-base-job/test-run.yml +++ b/ci/playbooks/test-base-job/test-run.yml @@ -3,6 +3,18 @@ hosts: "{{ cifmw_zuul_target_host | default('all') }}" gather_facts: true tasks: + # FIXME(amsinha/danpawlik): Current version of zuul does not support include-vars [1] from file, + # thus using this hack to read files. Will replace all these hacky var file read with include-vars + # once Zuul is upgraded. + # [1] https://zuul-ci.org/docs/zuul/latest/config/job.html#attr-job.include-vars + - name: Read group_vars + vars: + provided_dir: > + {{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/group_vars + ansible.builtin.include_role: + name: cifmw_helpers + tasks_from: var_dir.yml + - name: Filter out host if needed when: - cifmw_zuul_target_host is defined @@ -12,9 +24,9 @@ - name: Run the test playbook nested environment: - ANSIBLE_CONFIG: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework/ansible.cfg" + ANSIBLE_CONFIG: "{{ cifmw_project_dir_absolute }}/ansible.cfg" ansible.builtin.command: - chdir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework" + chdir: "{{ cifmw_project_dir_absolute }}" cmd: >- ansible-playbook ci/playbooks/test-base-job/nested-run.yml -i "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml"