zuul-jobs/roles/sphinx/tasks/main.yaml
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

88 lines
2.4 KiB
YAML

- name: By default, we use standard doc dir
set_fact:
use_doc_dir: true
- name: Check if sphinx_source_dir was changed
set_fact:
use_doc_dir: false
when: sphinx_source_dir != "doc/source"
- name: Attempt to get warning-is-error from config file
when:
- use_doc_dir
- sphinx_warning_is_error is not defined
sphinx_check_warning_is_error:
project_dir: "{{ zuul_work_dir }}"
register: check_result
- name: Set sphinx_warning_is_error
when:
- use_doc_dir
- sphinx_warning_is_error is not defined
set_fact:
sphinx_warning_is_error: "{{ check_result.warning_is_error }}"
sphinx_pbr_autodoc: "{{ check_result.autodoc_index_modules }}"
- name: Set sphinx_warning_is_error
when:
- not use_doc_dir
- sphinx_warning_is_error is not defined
set_fact:
# Non-default dirs always enable warnings
sphinx_warning_is_error: true
sphinx_pbr_autodoc: false
- name: Run sphinx
shell:
executable: /bin/bash
cmd: |
# Source the activate file so that sphinx subcommands have the correct
# paths set.
source {{ zuul_work_virtualenv }}/bin/activate
sphinx-build -b {{ zj_sphinx_builder }} \
{% if sphinx_warning_is_error %} -W {% endif %} \
{{ sphinx_source_dir }} {{ sphinx_build_dir }}/{{ zj_sphinx_builder }}
chdir: "{{ zuul_work_dir }}"
with_items: "{{ sphinx_builders }}"
loop_control:
loop_var: zj_sphinx_builder
when:
- not use_doc_dir or not sphinx_pbr_autodoc
# TODO(mordred) Remove this when we get projects off of the pbr autoindex
- name: Run sphinx using legacy pbr runner
shell:
executable: /bin/bash
cmd: |
# Source the activate file so that sphinx subcommands have the correct
# paths set.
source {{ zuul_work_virtualenv }}/bin/activate
python setup.py build_sphinx
chdir: "{{ zuul_work_dir }}"
when:
- use_doc_dir
- sphinx_pbr_autodoc
- name: Check for whereto
stat:
path: "{{ zuul_work_virtualenv }}/bin/whereto"
get_checksum: false
get_mime: false
register: whereto
- name: Check for htaccess
stat:
path: "{{ zuul_work_dir }}/{{ sphinx_source_dir }}/_extra/.htaccess"
get_checksum: false
get_mime: false
register: htaccess
- name: Run whereto
command:
cmd: "{{ whereto.stat.path }} {{ sphinx_source_dir }}/_extra/.htaccess doc/test/redirect-tests.txt"
chdir: "{{ zuul_work_dir }}"
when:
- whereto.stat.exists
- htaccess.stat.exists
- use_doc_dir