Lukas Kranz d8ec17cab0 Remove get_md5 parameter from stat module.
The get_md5 parameter was removed with ansible 9.
https://docs.ansible.com/ansible/latest/porting_guides/porting_guide_9.html#id44

If it is being used the following error appears:
"Unsupported parameters for (stat) module: get_md5..."

Unrelated, but also blocking testing/merging of this change, the
Ansible version specs for older python versions is loosened
to allow installing older versions of Ansible on test nodes (like
focal) that have older pythons that are unsupported by newer Ansible.

Change-Id: I99dd4f16fde659d84eb3dfa191557b3d9508b0fb
2024-08-01 07:12:17 -07:00

91 lines
2.2 KiB
YAML

# Sphinx might build multiple PDF files, for example for graphic files
# to include. We only want to grab the end result and not any such
# input files.
- name: Check for PDF file names
stat:
path: "{{ zuul_work_dir }}/{{ sphinx_build_dir }}/pdf/{{ zj_sphinx_pdf }}"
get_checksum: false
get_mime: false
with_items: "{{ sphinx_pdf_files }}"
loop_control:
loop_var: zj_sphinx_pdf
register: pdf_file_stat
- name: Set pdf_files_found to default
set_fact:
pdf_files_found: false
- name: Check if any file found
set_fact:
pdf_files_found: true
when: zj_pdf.stat.exists
with_items: "{{ pdf_file_stat.results }}"
loop_control:
loop_var: zj_pdf
# Now loop...
- name: Grab PDF files
when:
- pdf_files_found
- not zuul_use_fetch_output
block:
- name: Create PDF directory
delegate_to: localhost
file:
path: "{{ zuul.executor.log_root }}/pdf"
state: directory
mode: 0755
- name: Fetch PDF files
synchronize:
dest: "{{ zuul.executor.log_root }}/pdf/{{ zj_pdf.zj_sphinx_pdf }}"
mode: pull
src: "{{ zj_pdf.stat.path }}"
verify_host: true
owner: no
group: no
with_items: "{{ pdf_file_stat.results }}"
loop_control:
loop_var: zj_pdf
when: zj_pdf.stat.exists
- name: Copy PDF files
when:
- pdf_files_found
- zuul_use_fetch_output
block:
- name: Create local PDF directory
file:
path: "{{ zuul_output_dir }}/logs/pdf"
state: directory
mode: 0755
- name: Copy PDF files
copy:
dest: "{{ zuul_output_dir }}/logs/pdf/{{ zj_pdf.zj_sphinx_pdf }}"
src: "{{ zj_pdf.stat.path }}"
remote_src: true
mode: 0644
with_items: "{{ pdf_file_stat.results }}"
loop_control:
loop_var: zj_pdf
when: zj_pdf.stat.exists
- name: Return PDF artifact to Zuul
zuul_return:
data:
zuul:
artifacts:
- name: "Docs PDF: {{ zj_pdf.zj_sphinx_pdf }}"
url: "pdf/{{ zj_pdf.zj_sphinx_pdf }}"
metadata:
type: docs_pdf
with_items: "{{ pdf_file_stat.results }}"
loop_control:
loop_var: zj_pdf
when:
- pdf_files_found
- zj_pdf.stat.exists