fetch-zuul-cloner: use ensure-pip

Firstly, the "destination" variable was replaced with a virtualenv in
6bb1f6046b692ee2038eafd0965bd3095d6fa787; update the documentation and
prefix the name as is now standard for variables in this repo.  This
is not set anywhere so I think the prefixing is OK.

Call ensure-pip before installing, and use the virtualenv_command it
exports to create the environment for the zuul-cloner binary.

Story: #2007386
Task: #39311
Change-Id: I057191bf20ab1650a8926971dd386ce9cb1f03f5
This commit is contained in:
Ian Wienand 2020-04-07 09:39:38 +10:00 committed by Clark Boylan
parent 6dce7ba605
commit c877323de3
3 changed files with 15 additions and 7 deletions

View File

@ -1,10 +1,13 @@
Fetch the zuul-cloner shim and install to the destination.
**Role Variables**
.. zuul:rolevar:: repo_src_dir
Location of the Zuul source repositories.
.. zuul:rolevar:: destination
.. zuul:rolevar:: fetch_zuul_cloner_virtualenv
:default: ``/usr/zuul-env``
Where to install the zuul-cloner shim. This should be the full path
and filename.
The path to the virtualenv to install the shim. See the ensure-pip
role for details of virtualenv creation.

View File

@ -1 +1 @@
virtualenv: /usr/zuul-env
fetch_zuul_cloner_virtualenv: /usr/zuul-env

View File

@ -1,18 +1,23 @@
- name: Run ensure-pip
include_role:
name: ensure-pip
- name: Install zuul-cloner shim dependencies
pip:
name: PyYAML
virtualenv: "{{ virtualenv }}"
virtualenv_command: '{{ ensure_pip_virtualenv_command }}'
virtualenv: '{{ fetch_zuul_cloner_virtualenv }}'
become: yes
- name: Install zuul-cloner shim
template:
src: templates/zuul-cloner-shim.py.j2
dest: "{{ virtualenv }}/bin/zuul-cloner"
dest: "{{ fetch_zuul_cloner_virtualenv }}/bin/zuul-cloner"
become: yes
- name: Change zuul-cloner permissions
file:
path: "{{ virtualenv }}/bin/zuul-cloner"
path: "{{ fetch_zuul_cloner_virtualenv }}/bin/zuul-cloner"
mode: 0755
become: yes