diff --git a/zuul.d/playbooks/pre-gate-scenario.yml b/zuul.d/playbooks/pre-gate-scenario.yml index f3ba8901f8..57ee2938a5 100644 --- a/zuul.d/playbooks/pre-gate-scenario.yml +++ b/zuul.d/playbooks/pre-gate-scenario.yml @@ -23,6 +23,7 @@ install_methods: - distro - source + zuul_user_vars_file: "{{ ansible_env.HOME }}/osa-job-vars.yml" tasks: - name: Dynamically create scenario if not set set_fact: @@ -110,3 +111,13 @@ src: osa-gate-scenario.yml.j2 dest: "{{ zuul.executor.work_root }}/osa-gate-scenario.yml" delegate_to: localhost + + # Other playbooks can consume this vars file to access the + # Zuul job variables, see https://zuul-ci.org/docs/zuul/reference/jobs.html#user-jobs-job-variables + - name: Record the zuul user job variables for future use by embedded ansible + vars: + zuul_helper_var: + zuul: "{{ zuul }}" + template: + src: osa-job-vars.yml.j2 + dest: "{{ zuul_user_vars_file }}" diff --git a/zuul.d/playbooks/templates/osa-gate-scenario.yml.j2 b/zuul.d/playbooks/templates/osa-gate-scenario.yml.j2 index cf1ba2c5a6..fddaad258a 100644 --- a/zuul.d/playbooks/templates/osa-gate-scenario.yml.j2 +++ b/zuul.d/playbooks/templates/osa-gate-scenario.yml.j2 @@ -2,4 +2,5 @@ scenario: {{ scenario | to_json }} action: {{ action | to_json }} -install_method: {{ install_method | to_json }} \ No newline at end of file +install_method: {{ install_method | to_json }} +zuul_user_vars_file: {{ zuul_user_vars_file }} diff --git a/zuul.d/playbooks/templates/osa-job-vars.yml.j2 b/zuul.d/playbooks/templates/osa-job-vars.yml.j2 new file mode 100644 index 0000000000..077fdd9f30 --- /dev/null +++ b/zuul.d/playbooks/templates/osa-job-vars.yml.j2 @@ -0,0 +1,2 @@ +--- +{{ zuul_helper_var | to_nice_yaml(indent=2) }}