From 4859107757b9275fcffbacbe5971c3618d859f9f Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Fri, 17 Apr 2026 19:21:16 +0200 Subject: [PATCH] Respect passed Job vars during AIO bootstrap Right now there is no way to pass a variable through Zuul job to the bootstrap process, so that it is respected. Such ability might be beneficial, when we want to have a job testing some specific version. As bootstrap-aio we are already running with osa (not zuul ansible), this context is not available. So we introduce `zuul_job_vars` variable, which can be used in jobs, and contain other variables and data inside of it. Inside of the bootstrap process it can be accessed as zuul_vars variable Change-Id: I85757578824d63a49e97dad23cc854fb1e14d425 Signed-off-by: Dmitriy Rabotyagov --- scripts/log-collect.sh | 4 ++++ .../{gather_nodepool_vars.yml => gather_runtime_vars.yml} | 7 +++++++ tests/roles/bootstrap-host/tasks/main.yml | 4 ++-- zuul.d/playbooks/pre-gate-scenario.yml | 3 ++- zuul.d/playbooks/pre-osa-aio.yml | 1 + 5 files changed, 16 insertions(+), 3 deletions(-) rename tests/roles/bootstrap-host/tasks/{gather_nodepool_vars.yml => gather_runtime_vars.yml} (84%) diff --git a/scripts/log-collect.sh b/scripts/log-collect.sh index ca49f7beff..783f94f2e4 100755 --- a/scripts/log-collect.sh +++ b/scripts/log-collect.sh @@ -170,6 +170,10 @@ store_artifacts /openstack/log/ansible-logging/ "${WORKING_DIR}/logs/ansible" store_artifacts /openstack/log/ "${WORKING_DIR}/logs/openstack" store_artifacts /var/log/ "${WORKING_DIR}/logs/host" +# Gather Zuul specific scenario and job variables if they exist +store_artifacts /home/zuul/ "${WORKING_DIR}/zuul-info" "osa-gate-scenario.yml" +store_artifacts /home/zuul/ "${WORKING_DIR}/zuul-info" "osa-job-vars.yml" + # Build the ARA static html report if required if [[ "$ARA_REPORT_TYPE" == "html" ]]; then echo "Generating ARA static html report." diff --git a/tests/roles/bootstrap-host/tasks/gather_nodepool_vars.yml b/tests/roles/bootstrap-host/tasks/gather_runtime_vars.yml similarity index 84% rename from tests/roles/bootstrap-host/tasks/gather_nodepool_vars.yml rename to tests/roles/bootstrap-host/tasks/gather_runtime_vars.yml index 3d3d1a3cad..7092a35f4d 100644 --- a/tests/roles/bootstrap-host/tasks/gather_nodepool_vars.yml +++ b/tests/roles/bootstrap-host/tasks/gather_runtime_vars.yml @@ -34,3 +34,10 @@ - name: Set nodepool environment variables fact ansible.builtin.set_fact: nodepool_vars: "{{ nodepool_env.stdout | from_yaml }}" + +- name: Attempt to load custom var file (if exists) + ansible.builtin.include_vars: "{{ item }}" + with_first_found: + - files: + - "{{ aio_vars_file | default(ansible_facts.env.ZUUL_VARS_FILE) }}" + skip: true diff --git a/tests/roles/bootstrap-host/tasks/main.yml b/tests/roles/bootstrap-host/tasks/main.yml index 7d66d833ef..598d004ce7 100644 --- a/tests/roles/bootstrap-host/tasks/main.yml +++ b/tests/roles/bootstrap-host/tasks/main.yml @@ -43,8 +43,8 @@ tags: - always -- name: Gather nodepool variables - ansible.builtin.import_tasks: gather_nodepool_vars.yml +- name: Gather runtime variables + ansible.builtin.import_tasks: gather_runtime_vars.yml tags: - always diff --git a/zuul.d/playbooks/pre-gate-scenario.yml b/zuul.d/playbooks/pre-gate-scenario.yml index c14bbe91be..61dee41bb9 100644 --- a/zuul.d/playbooks/pre-gate-scenario.yml +++ b/zuul.d/playbooks/pre-gate-scenario.yml @@ -19,7 +19,7 @@ install_methods: - distro - source - zuul_user_vars_file: "{{ ansible_env.HOME }}/osa-job-vars.yml" + zuul_user_vars_file: "{{ ansible_facts.env.HOME }}/osa-job-vars.yml" tasks: - name: Dynamically create scenario if not set ansible.builtin.set_fact: @@ -118,6 +118,7 @@ vars: zuul_helper_var: zuul: "{{ zuul }}" + zuul_vars: "{{ zuul_job_vars | default({}) }}" zuul_site_mirror_info_helper_var: zuul_site_mirror_info: "{{ zuul_site_mirror_info | default({}) }}" ansible.builtin.template: diff --git a/zuul.d/playbooks/pre-osa-aio.yml b/zuul.d/playbooks/pre-osa-aio.yml index 5b9937de2c..8277c7c608 100644 --- a/zuul.d/playbooks/pre-osa-aio.yml +++ b/zuul.d/playbooks/pre-osa-aio.yml @@ -57,6 +57,7 @@ # ZUUL_SRC_PATH is used by tests/roles/bootstrap-host # symlink the zuul roles into /openstack/src ZUUL_SRC_PATH: "{{ _zuul_src_path }}" + ZUUL_VARS_FILE: "{{ zuul_user_vars_file }}" SCENARIO: "{{ scenario }}" ACTION: "{{ action }}" INSTALL_METHOD: "{{ install_method }}"