zuul-jobs/roles/fetch-sphinx-tarball/tasks/pdf.yaml
Andreas Jaeger c74b03649a Switch PDF fetching to known files
Some repos produce intermediate PDF files, for example from svg files,
and thus we have multiple PDF files.

Change the PDF fetching to a list of pdf_files which can be supplied,
the default is the name of the repos with ".pdf" attached, like
"octavia.pdf".

https://review.opendev.org/#/c/667249/3 illustrates the problem.

Change-Id: I5d3b6d6c2884ba66bdd35639b023d6d76f64ac01
2019-08-24 12:24:07 +02:00

57 lines
1.4 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/{{ item }}"
get_checksum: false
get_mime: false
get_md5: false
with_items: "{{ sphinx_pdf_files }}"
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: item.stat.exists
with_items: "{{ pdf_file_stat.results }}"
# Now loop...
- name: Grab PDF files
when: pdf_files_found
block:
- name: Create PDF directory
delegate_to: localhost
file:
path: "{{ zuul.executor.log_root }}/pdf"
state: directory
- name: Fetch PDF files
synchronize:
dest: "{{ zuul.executor.log_root }}/pdf/{{ item.item }}"
mode: pull
src: "{{ item.stat.path }}"
verify_host: true
with_items: "{{ pdf_file_stat.results }}"
when: item.stat.exists
- name: Return PDF artifact to Zuul
zuul_return:
data:
zuul:
artifacts:
- name: "Docs PDF: {{ item.item }}"
url: "pdf/{{ item.item }}"
metadata:
type: docs_pdf
with_items: "{{ pdf_file_stat.results }}"
when: item.stat.exists