zuul-jobs/roles/fetch-sphinx-tarball/tasks/html.yaml
Andreas Jaeger 5eb4c257f5 fetch-sphinx: Exclude doctrees directory
The sphinx .doctrees directory is not needed for publishing. By default
sphinx puts it below html. Some projects add to sphinx-build a "-d"
option to put the content elsewhere and not publish it.

This change assures that a .doctrees directory below "html" will not put
stored as artifact and published later.

Statistics: In all of OpenDev, we have:
* 511 repos putting .doctrees elsewhere and thus not publishing it
* 631 repos  no caring and thus publishing .doctrees

The size of .doctrees directory is not neglectable: 2MB for
system-config, 14 MB for nova.

Change-Id: I63b581164aab84352d9e80278cf4a8d634ff28af
2020-01-21 08:32:26 +01:00

44 lines
1.1 KiB
YAML

- name: Create temporary HTML archive file
tempfile:
state: file
suffix: ".tar.bz2"
register: html_archive
- name: Archive HTML
command: "tar -f {{ html_archive.path }} -C {{ zuul_work_dir }}/{{ sphinx_build_dir }}/html --exclude=.doctrees -cj ."
args:
warn: false
- name: Fetch archive HTML
synchronize:
dest: "{{ zuul.executor.log_root }}/docs-html.tar.bz2"
mode: pull
src: "{{ html_archive.path }}"
verify_host: true
- name: Create browseable HTML directory
delegate_to: localhost
file:
path: "{{ zuul.executor.log_root }}/docs"
state: directory
- name: Extract archive HTML
delegate_to: localhost
unarchive:
src: "{{ zuul.executor.log_root }}/docs-html.tar.bz2"
dest: "{{ zuul.executor.log_root }}/docs"
- name: Return artifact to Zuul
zuul_return:
data:
zuul:
artifacts:
- name: "Docs archive"
url: "docs-html.tar.bz2"
metadata:
type: docs_archive
- name: "Docs preview site"
url: "docs/"
metadata:
type: docs_site