Browse Source

[ci-workers] Install Python modules in a virtualenv

pull/128/head
Jack Grigg 7 years ago
parent
commit
c9c2650456
No known key found for this signature in database GPG Key ID: 665DBCD284F7DAFF
  1. 2
      contrib/ci-workers/files/bashrc
  2. 6
      contrib/ci-workers/templates/buildbot-worker.service.j2
  3. 24
      contrib/ci-workers/unix.yml
  4. 1
      contrib/ci-workers/vars/Archlinux.yml
  5. 1
      contrib/ci-workers/vars/CentOS.yml
  6. 7
      contrib/ci-workers/vars/default.yml

2
contrib/ci-workers/files/bashrc

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

6
contrib/ci-workers/templates/buildbot-worker.service.j2

@ -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 }}

24
contrib/ci-workers/unix.yml

@ -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

1
contrib/ci-workers/vars/Archlinux.yml

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

1
contrib/ci-workers/vars/CentOS.yml

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

7
contrib/ci-workers/vars/default.yml

@ -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

Loading…
Cancel
Save