project-config/playbooks/api-jobs/promote.yaml
Clark Boylan 2db422f0b8 Run ansible-lint on Ubuntu Noble
We ran into issues getting ansible-lint to run on Noble without updating
everything to current ish versions due to Python 3.12 compatibility
issues. Updating everything in this way created a bunch of new lint
errors we need to fix so we worked around the problem previously by
pinning back to Jammy.

Now we move the job back to Noble (the default Nodeset) and update the
tooling and fix the linter errors. This should allow us to move forward
in a productive manner on modern platforms.

The linter errors we fix include:

 * Naming every play
 * Ensuring every play name starts with a capital letter
 * Using fully qualified collection names for action modules
   (archive, git_config, and synchronize)
 * Quoting octal file modes

Change-Id: I96560c5ce2a5af39d39b3fc339862932a856bd13
2024-08-21 12:55:46 -07:00

74 lines
2.5 KiB
YAML

# This is a variant of https://opendev.org/opendev/base-jobs/src/branch/master/playbooks/docs/promote.yaml
# updated to calculate the service type.
- name: Promote API Documentation
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
- name: Extract docs archive
vars:
findme:
- "{{ zuul.executor.work_root }}/docs-html.tar.bz2"
- "{{ zuul.executor.work_root }}/docs-html.tar.gz"
unarchive:
src: "{{ lookup('first_found', findme) }}"
dest: "{{ zuul.executor.work_root }}/docs"
- name: Write root_marker file
include_role:
name: 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: Get service type
include_role:
name: set-service-type-data-fact
- name: Set target directory if master
when: "zuul.branch == 'master'"
set_fact:
target_dir: "/afs/.openstack.org/docs/{{ api_path }}/{{ service_type_data.service_type }}/"
- name: Set target directory if not master
when: "zuul.branch != 'master'"
fail:
msg: "This jobs should be only run on master branch."
- name: Get an AFS token
include_role:
name: create-afs-token
- name: Create publication directory
file:
path: "{{ target_dir }}"
state: directory
- 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