zuul-jobs/roles/fetch-sphinx-tarball/tasks/html.yaml
Ian Wienand 6d23d20f2f linters: add names to blocks
This is preparation for a later version of ansbile-lint, which finds
missing names on blocks.  This seems a reasonable rule, and the
Ansible manual says [1]

  Names for blocks have been available since Ansible 2.3. We recommend
  using names in all tasks, within blocks or elsewhere, for better
  visibility into the tasks being executed when you run the playbook.

This simply adds a name tag for blocks that are missing it.  This
should have no operational change, but allows us to update the linter
in a follow-on change.

[1] https://docs.ansible.com/ansible/latest/user_guide/playbooks_blocks.html

Change-Id: I92ed4616775650aced352bc9088a07e919f1a25f
2022-07-27 17:13:39 +10:00

77 lines
1.9 KiB
YAML

- name: Create temporary HTML archive file
tempfile:
state: file
suffix: ".tar.gz"
register: html_archive
- name: Archive HTML
command: "tar -f {{ html_archive.path }} -C {{ zuul_work_dir }}/{{ sphinx_build_dir }}/html --exclude=.doctrees -cz ."
args:
warn: false
- name: Fetch HTML
block:
- name: Fetch archive HTML
synchronize:
dest: "{{ zuul.executor.log_root }}/docs-html.tar.gz"
mode: pull
src: "{{ html_archive.path }}"
verify_host: true
owner: no
group: no
- name: Create browseable HTML directory
delegate_to: localhost
file:
path: "{{ zuul.executor.log_root }}/docs"
state: directory
mode: 0755
- name: Extract archive HTML
delegate_to: localhost
unarchive:
src: "{{ zuul.executor.log_root }}/docs-html.tar.gz"
dest: "{{ zuul.executor.log_root }}/docs"
remote_src: true
extra_opts:
- "--no-same-owner"
when: not zuul_use_fetch_output
- name: Copy HTML
block:
- name: Copy archive HTML
copy:
dest: "{{ zuul_output_dir }}/logs/docs-html.tar.gz"
src: "{{ html_archive.path }}"
mode: 0644
remote_src: true
- name: Create browseable HTML directory
file:
path: "{{ zuul_output_dir }}/logs/docs"
state: directory
mode: 0755
- name: Extract archive HTML
unarchive:
src: "{{ zuul_output_dir }}/logs/docs-html.tar.gz"
dest: "{{ zuul_output_dir }}/logs/docs"
remote_src: true
extra_opts:
- "--no-same-owner"
when: zuul_use_fetch_output
- name: Return artifact to Zuul
zuul_return:
data:
zuul:
artifacts:
- name: "Docs archive"
url: "docs-html.tar.gz"
metadata:
type: docs_archive
- name: "Docs preview site"
url: "docs/"
metadata:
type: docs_site