static-docs: use target from fileserver
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.
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
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: "{{ fileserver.path }}/{{ static_target }}/"
- - name: Set target directory if not master
- when: "zuul.branch != 'master'"
- fail:
- msg: "This jobs should be only run on master branch."
- name: Add fileserver
include_role:
name: add-fileserver
- name: Upload docs to static site
synchronize:
src: "{{ zuul.executor.work_root }}/docs/"
- dest: "{{ target_dir }}"
+ dest: "{{ fileserver.path }}/{{ static_target }}"
