Add promote api-ref/guide jobs

Add promote jobs for api-ref and api-guide jobs.

This adds a promote playbook since we need to calculate the service
type, for example for nova we publish to compute.

Related change: https://review.opendev.org/676624

Needed-By: https://review.opendev.org/676631
Change-Id: I6ca0b538b68a1dacd1144398975608f01e18d7de
This commit is contained in:
Andreas Jaeger 2019-08-15 10:15:07 +02:00
parent e3cd1b09d1
commit 501ce80275
2 changed files with 97 additions and 0 deletions

View File

@ -0,0 +1,55 @@
# This is a variant of https://opendev.org/opendev/base-jobs/src/branch/master/playbooks/docs/promote.yaml
# updated to calculate the service type.
- 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
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"
- include_role:
name: write-root-marker
vars:
root_marker_dir: "{{ zuul.executor.work_root }}/docs"
- name: Get service type
include_role:
name: set-service-type-data-fact
- name: Set target directory
when: "zuul.branch == 'master'"
set_fact:
target_dir: "/afs/.openstack.org/project/opendev.org/docs/{{ api_path }}/{{ service_type_data.service_type }}/"
- name: Set target directory
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
vars:
afs_source: "{{ zuul.executor.work_root }}/docs/"
afs_target: "{{ target_dir }}"
- name: Destroy AFS token
include_role:
name: destroy-afs-token

View File

@ -843,6 +843,48 @@
tox_envlist: api-ref
api_path: api-ref
- job:
name: promote-api-guide
parent: opendev-promote-docs-base
description: |
Publish api-guide document to
https://docs.openstack.org/api-guide.
This job is run in a promote pipeline to publish documents built
in the gate pipeline.
# We only publish the master branch, so no need to run
# for changes on other branches.
branches: master
final: true
run: playbooks/api-jobs/promote.yaml
vars:
api_path: api-guide
download_artifact_job: build-openstack-api-guide
secrets:
- secret: afsdocs_secret
name: afs
- job:
name: promote-api-ref
parent: opendev-promote-docs-base
description: |
Publish api-ref document to
https://docs.openstack.org/api-ref.
This job is run in a promote pipeline to publish documents built
in the gate pipeline.
# We only publish the master branch, so no need to run
# for changes on other branches.
branches: master
final: true
run: playbooks/api-jobs/promote.yaml
vars:
api_path: api-ref
download_artifact_job: build-openstack-api-ref
secrets:
- secret: afsdocs_secret
name: afs
- job:
name: publish-install-guide
description: |