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.

Change-Id: Ie9f73df453abb7321950f12b34dcc911b950d630
This commit is contained in:
Ian Wienand 2019-08-27 15:45:06 +10:00
parent 6ddcf28960
commit 91d294ac62
1 changed files with 5 additions and 9 deletions

View File

@ -6,6 +6,10 @@
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
@ -34,14 +38,6 @@
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
@ -52,4 +48,4 @@
- name: Upload docs to static site
synchronize:
src: "{{ zuul.executor.work_root }}/docs/"
dest: "{{ target_dir }}"
dest: "{{ fileserver.path }}/{{ static_target }}"