From 6db418c9827d2d205f6c1bde0229ff852b4e4dcc Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Tue, 4 Jul 2017 17:46:17 -0700 Subject: [PATCH] Ansible playbook for installing Zcash dependencies and Buildbot worker --- contrib/ci-workers/README.md | 4 +++ contrib/ci-workers/unix.yml | 56 +++++++++++++++++++++++++++++ contrib/ci-workers/vars/default.yml | 39 ++++++++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 contrib/ci-workers/README.md create mode 100644 contrib/ci-workers/unix.yml create mode 100644 contrib/ci-workers/vars/default.yml diff --git a/contrib/ci-workers/README.md b/contrib/ci-workers/README.md new file mode 100644 index 000000000..72b832fcb --- /dev/null +++ b/contrib/ci-workers/README.md @@ -0,0 +1,4 @@ +# Zcash CI workers + +This folder contains the Ansible playbooks for configuring a fresh OS +installation for use as a Buildbot worker in Zcash's CI. diff --git a/contrib/ci-workers/unix.yml b/contrib/ci-workers/unix.yml new file mode 100644 index 000000000..94e122447 --- /dev/null +++ b/contrib/ci-workers/unix.yml @@ -0,0 +1,56 @@ +--- +- name: Configure a Buildbot worker for Zcash CI + hosts: zcash-ci-worker-unix + become: true + gather_facts: False + + pre_tasks: + - set_fact: + python_raw: "test -e /usr/bin/python || test -e /usr/bin/python2 || test -e /usr/bin/python2.7 || test -e /usr/local/bin/python2.7 || (test -e /usr/bin/apt && apt -qqy update && apt install -qqy python) || (test -e /usr/bin/dnf && dnf install -qqy python2) || (test -e /usr/sbin/pkg && pkg install -qqy python2)" + - name: Install Python 2 for Ansible and Buildbot [bash] + raw: bash -c "'{{ python_raw }}'" + ignore_errors: true + register: output + changed_when: + - output.stdout != "" + - output.stdout != "\r\n" + - name: Install Python 2 for Ansible and Buildbot [tcsh] + raw: tcsh -c "{{ python_raw }}" + ignore_errors: true + register: output + changed_when: + - output.stdout != "" + - output.stdout != "\r\n" + - name: Gathering Facts + setup: + + tasks: + - name: Get default dependencies + include_vars: "vars/default.yml" + + - name: Get dependencies for distribution + include_vars: "{{ item }}" + with_first_found: + - files: + - "vars/{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml" + - "vars/{{ ansible_distribution }}-{{ ansible_distribution_major_version | int }}.yml" + - "vars/{{ ansible_distribution }}.yml" + - "vars/{{ ansible_os_family }}.yml" + skip: true + + - name: Collate dependencies + set_fact: + package_deps: "{{ buildbot_deps + fetch_deps + conf_deps + build_deps + link_deps + dist_deps }}" + python_modules: "{{ buildbot_modules + rpc_test_modules }}" + + - name: Install required packages + package: + name: "{{ item }}" + state: present + with_items: "{{ package_deps }}" + + - name: Install required Python modules + pip: + name: "{{ item }}" + state: latest + with_items: "{{ python_modules }}" diff --git a/contrib/ci-workers/vars/default.yml b/contrib/ci-workers/vars/default.yml new file mode 100644 index 000000000..9aa79da5e --- /dev/null +++ b/contrib/ci-workers/vars/default.yml @@ -0,0 +1,39 @@ +--- +# These variables can be overridden in distribution files. + +# Dependencies required to install Buildbot +buildbot_deps: + - python-pip # So we can install Python modules + +# Dependencies required to download files +fetch_deps: + - git + - wget # For zcutil/fetch-params.sh + +# Dependencies required to configure Zcash +conf_deps: + - autoconf + - automake + - m4 + +# Dependencies required to compile Zcash +build_deps: + - g++ + - gcc + - make + +# Dependencies required to link Zcash +link_deps: + - libtool + +# Additional distribution-specific dependencies +dist_deps: [] + +# Python modules required for a Zcash Buildbot worker +buildbot_modules: + - pip # Needs to be updated first so Buildbot installs + - buildbot-worker + +# Python modules required to run the Zcash RPC test suite +rpc_test_modules: + - pyzmq