[ci-workers] Install Python modules in a virtualenv

This commit is contained in:
Jack Grigg 2017-10-20 15:34:11 +13:00
parent 0952b02585
commit c9c2650456
No known key found for this signature in database
GPG Key ID: 665DBCD284F7DAFF
6 changed files with 29 additions and 12 deletions

View File

@ -0,0 +1,2 @@
export PATH=$HOME/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export EDITOR=vim

View File

@ -7,9 +7,9 @@ After=network.target
Type=forking
PIDFile=/home/{{ buildbot_worker_user }}/{{ buildbot_worker_name }}/twistd.pid
WorkingDirectory=/home/{{ buildbot_worker_user }}
ExecStart={{ pip_bin_dir }}/buildbot-worker start {{ buildbot_worker_name }}
ExecReload={{ pip_bin_dir }}/buildbot-worker restart {{ buildbot_worker_name }}
ExecStop={{ pip_bin_dir }}/buildbot-worker stop {{ buildbot_worker_name }}
ExecStart=/home/{{ buildbot_worker_user }}/venv/bin/buildbot-worker start {{ buildbot_worker_name }}
ExecReload=/home/{{ buildbot_worker_user }}/venv/bin/buildbot-worker restart {{ buildbot_worker_name }}
ExecStop=/home/{{ buildbot_worker_user }}/venv/bin/buildbot-worker stop {{ buildbot_worker_name }}
Restart=always
User={{ buildbot_worker_user }}

View File

@ -88,12 +88,11 @@
include: tasks/install-pip.yml
when: ansible_distribution == 'CentOS'
- name: Install required Python modules
- name: Install required Python system modules
pip:
name: "{{ item }}"
state: latest
with_items: "{{ python_modules }}"
notify: restart buildbot-worker
with_items: "{{ system_modules }}"
- name: Set up the Buildbot worker user
user:
@ -102,9 +101,18 @@
shell: /bin/bash
state: present
- name: Install required Python modules
pip:
name: "{{ item }}"
state: latest
virtualenv: "~{{ buildbot_worker_user }}/venv"
with_items: "{{ python_modules }}"
become_user: "{{ buildbot_worker_user }}"
notify: restart buildbot-worker
- name: Create Buildbot worker
command: >
buildbot-worker create-worker ~/{{ buildbot_worker_name }}
~{{ buildbot_worker_user }}/venv/bin/buildbot-worker create-worker ~/{{ buildbot_worker_name }}
{{ buildbot_master_host }}:{{ buildbot_master_port }}
{{ buildbot_worker_name|quote }} {{ buildbot_worker_password|quote }}
args:
@ -127,6 +135,14 @@
group: "{{ buildbot_worker_user }}"
mode: "0644"
- name: Install custom bashrc for virtualenv
copy:
src: bashrc
dest: "~{{ buildbot_worker_user }}/.bashrc"
owner: "{{ buildbot_worker_user }}"
group: "{{ buildbot_worker_user }}"
mode: "0644"
- name: Copy Buildbot worker systemd service unit
template:
src: templates/buildbot-worker.service.j2

View File

@ -4,4 +4,3 @@ buildbot_deps:
build_deps:
- multilib/gcc
- make
pip_bin_dir: /usr/bin

View File

@ -10,4 +10,3 @@ dist_deps:
- pkgconfig # Required until b556beda264308e040f8d88aca4f2f386a0183d9 is pulled in
- python-devel
- redhat-rpm-config
pip_bin_dir: /usr/bin

View File

@ -34,6 +34,10 @@ grind_deps:
- lcov
- valgrind
# Python modules required on the system
system_modules:
- virtualenv
# Python modules required for a Zcash Buildbot worker
buildbot_modules:
- pip # Needs to be updated first so Buildbot installs
@ -44,6 +48,3 @@ buildbot_modules:
rpc_test_modules:
- pyblake2
- pyzmq
# Environment variables
pip_bin_dir: /usr/local/bin