
Handle the name change in the dependent change. Should have no functional change. Depends-On: https://review.opendev.org/705368 Change-Id: I4f0ebd633f68d6d75179976f4743e53878837df3
70 lines
2.3 KiB
YAML
70 lines
2.3 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
|
|
- name: Extract docs archive
|
|
unarchive:
|
|
src: "{{ zuul.executor.work_root }}/docs-html.tar.bz2"
|
|
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_dir: "{{ afs.docs_master_path }}"
|
|
- name: Set target directory if not master
|
|
when: "zuul.branch != 'master'"
|
|
set_fact:
|
|
target_dir: "{{ afs.docs_branch_path }}"
|
|
- name: Get an AFS token
|
|
include_role:
|
|
name: create-afs-token
|
|
- name: Create publication directory
|
|
file:
|
|
path: "{{ target_dir }}"
|
|
state: directory
|
|
- name: Create redirect htaccess file
|
|
when: "afs.docs_redirect_path is defined and zuul.branch == 'master'"
|
|
copy:
|
|
dest: "{{ afs.docs_redirect_path }}"
|
|
content: "{{ afs.docs_redirect_content }}"
|
|
- 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
|