From fa63c7b555017f8e9d41a1e8c18ece943f0eb0b1 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Fri, 17 Nov 2017 09:02:24 -0600 Subject: [PATCH] Add ensure-reno and ensure-babel roles ensure-reno was written in openstack-zuul-jobs but it's not openstack specific (or won't be once we remove the pip install . line) ensure-babel is a similar role for installing babel. Change-Id: I7827a63170168db5a6501b28d379e458171d556a --- roles/ensure-babel/README.rst | 7 +++++ roles/ensure-babel/tasks/main.yaml | 32 +++++++++++++++++++++++ roles/ensure-reno/README.rst | 14 ++++++++++ roles/ensure-reno/defaults/main.yaml | 1 + roles/ensure-reno/tasks/main.yaml | 39 ++++++++++++++++++++++++++++ 5 files changed, 93 insertions(+) create mode 100644 roles/ensure-babel/README.rst create mode 100644 roles/ensure-babel/tasks/main.yaml create mode 100644 roles/ensure-reno/README.rst create mode 100644 roles/ensure-reno/defaults/main.yaml create mode 100644 roles/ensure-reno/tasks/main.yaml diff --git a/roles/ensure-babel/README.rst b/roles/ensure-babel/README.rst new file mode 100644 index 000000000..e8dc70f57 --- /dev/null +++ b/roles/ensure-babel/README.rst @@ -0,0 +1,7 @@ +Ensure babel is installed + +**Role Variables** + +.. zuul:rolevar:: constraints_file + + Optional path to a pip constraints file for installing python libraries. diff --git a/roles/ensure-babel/tasks/main.yaml b/roles/ensure-babel/tasks/main.yaml new file mode 100644 index 000000000..b61734965 --- /dev/null +++ b/roles/ensure-babel/tasks/main.yaml @@ -0,0 +1,32 @@ +- 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: Install babel + pip: + name: + - pbr + - Babel + - lxml + - requests + # Install subunit for the subunit output stream for + # healthcheck.openstack.org. + # TODO(mordred) Does this need to be os-testr or can it just be subunit? + - os-testr + extra_args: "--user {{ upper_constraints|default('') }}" diff --git a/roles/ensure-reno/README.rst b/roles/ensure-reno/README.rst new file mode 100644 index 000000000..87b233636 --- /dev/null +++ b/roles/ensure-reno/README.rst @@ -0,0 +1,14 @@ +Ensure reno is installed + +**Role Variables** + +.. zuul:rolevar:: constraints_file + + Optional path to a pip constraints file for installing python libraries. + +.. 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. diff --git a/roles/ensure-reno/defaults/main.yaml b/roles/ensure-reno/defaults/main.yaml new file mode 100644 index 000000000..9739eb171 --- /dev/null +++ b/roles/ensure-reno/defaults/main.yaml @@ -0,0 +1 @@ +zuul_work_dir: "{{ zuul.project.src_dir }}" diff --git a/roles/ensure-reno/tasks/main.yaml b/roles/ensure-reno/tasks/main.yaml new file mode 100644 index 000000000..b02eac753 --- /dev/null +++ b/roles/ensure-reno/tasks/main.yaml @@ -0,0 +1,39 @@ +- 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: Install reno + pip: + name: + - sphinx + - openstackdocstheme + - reno + extra_args: "--user {{ upper_constraints|default('') }}" + +- name: Install extra requirements if needed + shell: + chdir: '{{ zuul_work_dir }}' + executable: /bin/bash + cmd: | + # 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. + if [ -f setup.cfg ] ; then + pip install --user . || true + fi