From c8d6bae093aa45154a37e51ae38d16dbffb61e7d Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Fri, 22 Mar 2019 09:50:57 -0500 Subject: [PATCH] wheelhost: Publish wheels built by Jenkins The point of the "wheel host" is to serve as a repository of Python packages (wheels) built by Jenkins for consumption by `pip` et al. For applications and libraries that do not provide all of their dependencies as binary packages, this makes a convenient way to install them without requiring all of the build tools and dependencies on the destination machine. The idea here is that a Jenkins job runs `pip wheel` for a distribution package name or `requirements.txt` file and then uploads the resulting wheel files using `rsync`. Apache is configured to serve the upload directory with an index compatible with `pip`'s `--find-links`. --- hosts | 3 +++ roles/wheelhost/files/wheels.httpd.conf | 7 +++++ roles/wheelhost/handlers/main.yml | 4 +++ roles/wheelhost/tasks/main.yml | 34 +++++++++++++++++++++++++ wheelhost.yml | 4 +++ 5 files changed, 52 insertions(+) create mode 100644 roles/wheelhost/files/wheels.httpd.conf create mode 100644 roles/wheelhost/handlers/main.yml create mode 100644 roles/wheelhost/tasks/main.yml create mode 100644 wheelhost.yml diff --git a/hosts b/hosts index b6fe881..f429ff4 100644 --- a/hosts +++ b/hosts @@ -117,3 +117,6 @@ zbx0.pyrocufflink.blue pyrocufflink [vm-hosts] + +[wheelhost] +file0.pyrocufflink.blue diff --git a/roles/wheelhost/files/wheels.httpd.conf b/roles/wheelhost/files/wheels.httpd.conf new file mode 100644 index 0000000..8a65b1a --- /dev/null +++ b/roles/wheelhost/files/wheels.httpd.conf @@ -0,0 +1,7 @@ +Alias /wheels /var/lib/wheels + + + Require all granted + Options +Indexes + IndexOptions -FancyIndexing -HTMLTable + diff --git a/roles/wheelhost/handlers/main.yml b/roles/wheelhost/handlers/main.yml new file mode 100644 index 0000000..09fd3c8 --- /dev/null +++ b/roles/wheelhost/handlers/main.yml @@ -0,0 +1,4 @@ +- name: reload httpd + service: + name=httpd + state=reloaded diff --git a/roles/wheelhost/tasks/main.yml b/roles/wheelhost/tasks/main.yml new file mode 100644 index 0000000..350b80f --- /dev/null +++ b/roles/wheelhost/tasks/main.yml @@ -0,0 +1,34 @@ +- name: ensure rsync is installed + package: + name=rsync + state=present + tags: + - install + +- name: ensure wheel storage directory exists + file: + path=/var/lib/wheels + owner=root + group=root + mode=0775 + state=directory + +- name: ensure jenkins can write to the wheel storage directory + acl: + path: /var/lib/wheels + etype: user + entity: jenkins + permissions: rwx + default: '{{ item == "default" }}' + state: present + with_items: + - default + - current + +- name: ensure apache is configured to serve wheel directory + copy: + src=wheels.httpd.conf + dest=/etc/httpd/conf.d/wheels.conf + mode=0644 + notify: + - reload httpd diff --git a/wheelhost.yml b/wheelhost.yml new file mode 100644 index 0000000..cf4b320 --- /dev/null +++ b/wheelhost.yml @@ -0,0 +1,4 @@ +- hosts: wheelhost + roles: + - web + - wheelhost