91d294ac62
The "target_dir" fact is set only for localhost, so can't be referenced below when running the synchronize on the fileserver. fileserver.path and static_target should be set globally and can be referenced in the synchronize step. Move the master branch check out and earlier. Change-Id: Ie9f73df453abb7321950f12b34dcc911b950d630
52 lines
1.8 KiB
YAML
52 lines
1.8 KiB
YAML
# This is a variant of https://opendev.org/opendev/base-jobs/src/branch/master/playbooks/docs/promote.yaml
|
|
# It publishes to a single directory.
|
|
- 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: Check target branch is master
|
|
when: "zuul.branch != 'master'"
|
|
fail:
|
|
msg: "This job should be only run on the master branch."
|
|
- 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: Find PDF files
|
|
find:
|
|
paths: "{{ zuul.executor.work_root }}/pdf/"
|
|
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: Add fileserver
|
|
include_role:
|
|
name: add-fileserver
|
|
|
|
- hosts: "{{ fileserver.fqdn }}"
|
|
gather_facts: False
|
|
tasks:
|
|
- name: Upload docs to static site
|
|
synchronize:
|
|
src: "{{ zuul.executor.work_root }}/docs/"
|
|
dest: "{{ fileserver.path }}/{{ static_target }}"
|