Split reno installation into a role

Similar to ensure-tox, split installing reno in to its own role.

Change-Id: I8ac7c40f1fe8b590c4184437bf50a7c03cf2b45f
This commit is contained in:
Monty Taylor 2017-11-16 17:19:18 -06:00
parent e1f088c850
commit 5c77008c3d
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
5 changed files with 54 additions and 43 deletions

View File

@ -1,3 +1,4 @@
- hosts: all
roles:
- ensure-reno
- build-releasenotes

View File

@ -1,52 +1,9 @@
- name: Install gettext package
package:
name: gettext
state: present
become: yes
# TODO(mordred) Put the translations logic into a sphinx plugin?
- name: Check if translations exist for release notes
stat:
path: "{{ zuul_work_dir }}/releasenotes/source/locale"
register: translations
- name: Check to see if the constraints file exists
stat:
path: "{{ constraints_file|default('missing') }}"
get_checksum: false
get_mime: false
get_md5: false
register: stat_results
when: constraints_file is defined
- name: Record file location
set_fact:
upper_constraints: "-c {{ constraints_file }}"
when: not stat_results|skipped and stat_results.stat.exists
- name: Setup venv
shell:
chdir: '{{ zuul_work_dir }}'
executable: /bin/bash
cmd: |
set -e
set -x
UPPER_CONSTRAINTS="{{ upper_constraints }}"
python -m virtualenv .venv
VENV=.venv/bin
$VENV/pip install sphinx $UPPER_CONSTRAINTS
$VENV/pip install openstackdocstheme $UPPER_CONSTRAINTS
$VENV/pip install reno $UPPER_CONSTRAINTS
# Optionally, install local requirements
if [ -e releasenotes/requirements.txt ] ; then
$VENV/pip install -r releasenotes/requirements.txt $UPPER_CONSTRAINTS
fi
# TODO(jaegerandi): Remove once all repos are fixed.
# Try installing current repo in case it needs to be available for
# example for version number calculation. Ignore any failures here.
$VENV/pip install . || true
- name: Prepare release note translations
shell:
chdir: '{{ zuul_work_dir }}'

View File

@ -0,0 +1,10 @@
Ensure reno is installed
**Role Variables**
.. zuul:rolevar:: zuul_work_dir
:default: {{ zuul.project.src_dir }}
Directory to operate in. Needed only for a little while until we have
projects migrated to not need to be installed just to generate
release notes.

View File

@ -0,0 +1 @@
zuul_work_dir: "{{ zuul.project.src_dir }}"

View File

@ -0,0 +1,42 @@
- name: Install gettext package
package:
name: gettext
state: present
become: yes
- name: Check to see if the constraints file exists
stat:
path: "{{ constraints_file|default('missing') }}"
get_checksum: false
get_mime: false
get_md5: false
register: stat_results
when: constraints_file is defined
- name: Record file location
set_fact:
upper_constraints: "-c {{ constraints_file }}"
when: not stat_results|skipped and stat_results.stat.exists
- name: Setup venv
shell:
chdir: '{{ zuul_work_dir }}'
executable: /bin/bash
cmd: |
set -e
set -x
UPPER_CONSTRAINTS="{{ upper_constraints }}"
python -m virtualenv .venv
VENV=.venv/bin
$VENV/pip install sphinx $UPPER_CONSTRAINTS
$VENV/pip install openstackdocstheme $UPPER_CONSTRAINTS
$VENV/pip install reno $UPPER_CONSTRAINTS
# Optionally, install local requirements
if [ -e releasenotes/requirements.txt ] ; then
$VENV/pip install -r releasenotes/requirements.txt $UPPER_CONSTRAINTS
fi
# TODO(jaegerandi): Remove once all repos are fixed.
# Try installing current repo in case it needs to be available for
# example for version number calculation. Ignore any failures here.
$VENV/pip install . || true