# 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