Fix promote-service-types-authority

This job only publishes part of the directory and needs to keep old content
around. Thus, add a new promote playbook that uses the
upload-afs-synchronize rule to not delete old content like the normal
playbook in the parent does.

Change-Id: I13f9faf698ec459f1d7cd7a950172d836b470a4c
This commit is contained in:
Andreas Jaeger 2020-02-21 08:43:01 +01:00
parent 65689b1e42
commit de9c644dce
2 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,52 @@
# This is a variant of https://opendev.org/opendev/base-jobs/src/branch/master/playbooks/docs/promote.yaml
# It uses upload-afs-syncronize instead of upload-afs-roots to add content
# but not delete. It is also simplified for repository
# openstack/service-types-authority.
- 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: Set target directory if master
when: "zuul.branch == 'master'"
set_fact:
target_dir: "/afs/.openstack.org/project/{{ publish_site }}/"
- 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-synchronize
vars:
afs_source: "{{ zuul.executor.work_root }}/docs/"
afs_target: "{{ target_dir }}"
- name: Destroy AFS token
include_role:
name: destroy-afs-token

View File

@ -386,6 +386,7 @@
This is a promote job for ``service-types-authority-tox-publish``. This is a promote job for ``service-types-authority-tox-publish``.
final: true final: true
run: playbooks/service-types/promote.yaml
allowed-projects: allowed-projects:
- openstack/service-types-authority - openstack/service-types-authority
vars: vars: