Merge "Refactor run-docs role to use tox role"

This commit is contained in:
Zuul 2017-09-06 02:11:44 +00:00 committed by Gerrit Code Review
commit 77d0e517e3
6 changed files with 13 additions and 54 deletions

View File

@ -0,0 +1,3 @@
- hosts: all
roles:
- prepare-docs-for-afs

View File

@ -1,4 +0,0 @@
- hosts: all
roles:
- role: run-docs
envlist: venv

View File

@ -0,0 +1,2 @@
---
zuul_work_dir: "src/{{ zuul.project.canonical_name }}"

View File

@ -1,47 +1,10 @@
- name: Require tox_envlist variable - {{ tox_envlist }} - name: Process built docs to prepare for AFS publication
fail:
msg: "tox_envlist is required for this role"
when: tox_envlist is not defined
- name: Create my_tox_environment variable
set_fact:
my_tox_environment: "{{ tox_environment_defaults | combine(tox_environment) }}"
# NOTE(pabelanger): This needs to be refactored to use our tox role in
# zuul-jobs. But right now, this is very openstack specific.
- name: Execute run-docs.sh.
args: args:
chdir: "{{ zuul_work_dir | default(omit) }}" chdir: "{{ zuul_work_dir }}"
executable: /bin/bash executable: /bin/bash
environment: "{{ my_tox_environment }}"
shell: | shell: |
set -ex set -ex
# If a bundle file is present, call tox with the jenkins version of
# the test environment so it is used. Otherwise, use the normal
# (non-bundle) test environment. Also, run pbr freeze on the
# resulting environment at the end so that we have a record of exactly
# what packages we ended up testing.
#
venv={{ tox_envlist }}
tags_handling=${2:both} tags_handling=${2:both}
mkdir -p doc/build
export HUDSON_PUBLISH_DOCS=1
# The "python setup.py build_sphinx" is intentionally executed instead of
# "tox -edocs", because it's the standard python project build interface
# specified in OpenStack Project Testing Interface:
# http://governance.openstack.org/reference/project-testing-interface.html
tox -e$venv -- python setup.py build_sphinx
result=$?
[ -e .tox/$venv/bin/pbr ] && freezecmd=pbr || freezecmd=pip
echo "Begin pbr freeze output from test virtualenv:"
echo "======================================================================"
.tox/${venv}/bin/${freezecmd} freeze
echo "======================================================================"
MARKER_TEXT="Project: $ZUUL_PROJECT Ref: $ZUUL_REFNAME Build: $ZUUL_UUID Revision: $ZUUL_NEWREV" MARKER_TEXT="Project: $ZUUL_PROJECT Ref: $ZUUL_REFNAME Build: $ZUUL_UUID Revision: $ZUUL_NEWREV"
echo $MARKER_TEXT > doc/build/html/.root-marker echo $MARKER_TEXT > doc/build/html/.root-marker
@ -78,7 +41,7 @@
elif echo $ZUUL_REFNAME | grep stable/ >/dev/null ; then elif echo $ZUUL_REFNAME | grep stable/ >/dev/null ; then
# Put stable release changes in dir named after stable release under the # Put stable release changes in dir named after stable release under the
# build dir. When Jenkins copies these files they will be accessible under # build dir. When Jenkins copies these files they will be accessible under
# the developer docs root using the stable release's name. # the developer docs root using the stable release name.
BRANCH=$(echo $ZUUL_REFNAME | sed 's/stable.//') BRANCH=$(echo $ZUUL_REFNAME | sed 's/stable.//')
if [ ! -z $BRANCH ] ; then if [ ! -z $BRANCH ] ; then
# Move the docs into a subdir if this is a stable branch build # Move the docs into a subdir if this is a stable branch build
@ -97,4 +60,3 @@
mkdir -p doc/build/html/$TOP mkdir -p doc/build/html/$TOP
mv doc/build/tmp doc/build/html/$BRANCH mv doc/build/tmp doc/build/html/$BRANCH
fi fi
exit $result

View File

@ -1,8 +0,0 @@
---
tox_environment: {}
tox_environment_defaults: {}
tox_envlist: venv
tox_executable: tox
tox_extra_args: -vv
zuul_work_dir: "src/{{ zuul.project.canonical_name }}"

View File

@ -6,12 +6,16 @@
- job: - job:
name: openstack-doc-build name: openstack-doc-build
parent: tox-docs parent: tox-docs
run: playbooks/tox/docs post-run: playbooks/openstack-doc-build/post
required-projects: required-projects:
- name: openstack/requirements - name: openstack/requirements
roles:
- zuul: openstack-infra/zuul-jobs
vars: vars:
tox_environment: tox_environment:
UPPER_CONSTRAINTS_FILE: "{{ ansible_user_dir }}/src/git.openstack.org/openstack/requirements/upper-constraints.txt" UPPER_CONSTRAINTS_FILE: "{{ ansible_user_dir }}/src/git.openstack.org/openstack/requirements/upper-constraints.txt"
tox_envlist: venv
tox_extra_args: -vv python setup.py build_sphinx
- job: - job:
name: tox-py35-on-zuul name: tox-py35-on-zuul