
Several things have bit rotted in here that we need to take care of. First is that we updated the default nodeset to Noble which breaks our ability to install Pillow<10 for blockdiag. To fix this we need to install libjpeg-dev so that we can build a Pillow wheel locally during testing. Next old ansible-lint doesn't run on Noble's python3.12. We bump up Ansible lint to a modern version that matches Zuul's current default Ansible. We also stop installing zuul to get zuul_console and zuul_return and instead simply mock them in the linter. To make this work we have to drop the ansible-playbook syntax check run which is fine because ansible-lint runs this too, but when done via ansible-lint the mocked modules are respected [0]. Finally we have to clean up/ignore some of the new linter warnings/errors. [0] https://ansible.readthedocs.io/projects/lint/rules/syntax-check/ Change-Id: Ia0e936fefc9e2b0f2fa614c93a2f168e14b2825b
97 lines
3.4 KiB
YAML
97 lines
3.4 KiB
YAML
- hosts: localhost
|
|
tasks:
|
|
- name: Check execution context
|
|
when: "zuul.branch is not defined"
|
|
fail:
|
|
msg: "This playbook must be run in a branch-based pipeline (e.g., 'promote')."
|
|
- name: Download docs archive
|
|
include_role:
|
|
name: download-artifact
|
|
vars:
|
|
# download_artifact_job: provided by zuul job
|
|
download_artifact_api: "https://zuul.opendev.org/api/tenant/{{ zuul.tenant }}"
|
|
download_artifact_type:
|
|
- docs_archive
|
|
- docs_pdf
|
|
download_artifact_pipeline: gate
|
|
- name: Create working directory
|
|
file:
|
|
path: "{{ zuul.executor.work_root }}/docs"
|
|
state: directory
|
|
mode: "0755"
|
|
- name: Extract docs archive
|
|
# TODO(clarkb) what is the proper way to set mode on this task?
|
|
vars:
|
|
findme:
|
|
- "{{ zuul.executor.work_root }}/docs-html.tar.bz2"
|
|
- "{{ zuul.executor.work_root }}/docs-html.tar.gz"
|
|
unarchive: # noqa 208
|
|
src: "{{ lookup('first_found', findme) }}"
|
|
dest: "{{ zuul.executor.work_root }}/docs"
|
|
- name: Write root_marker file
|
|
include_role:
|
|
name: write-root-marker
|
|
when: "write_root_marker"
|
|
vars:
|
|
root_marker_dir: "{{ zuul.executor.work_root }}/docs"
|
|
- name: Find PDF files
|
|
find:
|
|
paths: "{{ zuul.executor.work_root }}/"
|
|
file_type: file
|
|
patterns: "*.pdf"
|
|
register: pdf_files
|
|
- name: Move found PDF file into doc dir
|
|
command: "mv {{ item.path }} {{ zuul.executor.work_root }}/docs"
|
|
with_items: "{{ pdf_files.files }}"
|
|
when: pdf_files.matched > 0
|
|
- name: Set target directory if master
|
|
when: "zuul.branch == 'master'"
|
|
set_fact:
|
|
target_dict: "{{ afs.targets.master }}"
|
|
- name: Set target directory if not master
|
|
when: "zuul.branch != 'master'"
|
|
set_fact:
|
|
target_dict: "{{ afs.targets.branch }}"
|
|
- name: Set publish site
|
|
set_fact:
|
|
publish_site: "{{ publish_site.format(zuul=zuul) }}"
|
|
when: publish_site is defined
|
|
- name: Set target path
|
|
set_fact:
|
|
target_dir: "{{ target_dict.path.format(zuul=zuul, publish_site=publish_site, special_publish_directory=special_publish_directory) }}"
|
|
- name: Adjust target path
|
|
when: "target_dict.regex is defined"
|
|
set_fact:
|
|
target_dir: "{{ target_dir | regex_replace(target_dict.regex.pattern, target_dict.regex.sub) }}"
|
|
- name: Get an AFS token
|
|
include_role:
|
|
name: create-afs-token
|
|
- name: Create publication directory
|
|
file:
|
|
path: "{{ target_dir }}"
|
|
state: directory
|
|
mode: "0755"
|
|
- name: Set redirect target directory
|
|
when: "target_dict.redirect is defined"
|
|
set_fact:
|
|
redirect_target_dir: "{{ target_dict.redirect.path.format(zuul=zuul) }}"
|
|
- name: Set redirect content
|
|
when: "target_dict.redirect is defined"
|
|
set_fact:
|
|
redirect_content: "{{ target_dict.redirect.content.format(zuul=zuul) }}"
|
|
- name: Create redirect htaccess file
|
|
when: "target_dict.redirect is defined"
|
|
copy:
|
|
dest: "{{ redirect_target_dir }}"
|
|
content: "{{ redirect_content }}"
|
|
mode: "0644"
|
|
- name: Upload to AFS
|
|
include_role:
|
|
name: upload-afs-roots
|
|
vars:
|
|
afs_source: "{{ zuul.executor.work_root }}/docs/"
|
|
afs_target: "{{ target_dir }}"
|
|
- name: Destroy AFS token
|
|
include_role:
|
|
name: destroy-afs-token
|