Browse Source

[ci-workers] Add support for MacOSX

pull/4/head
Jack Grigg 7 years ago
parent
commit
9d1c37f793
No known key found for this signature in database GPG Key ID: 665DBCD284F7DAFF
  1. 10
      contrib/ci-workers/tasks/install-brew.yml
  2. 23
      contrib/ci-workers/templates/buildbot-worker.plist.j2
  3. 38
      contrib/ci-workers/unix.yml
  4. 5
      contrib/ci-workers/vars/MacOSX.yml

10
contrib/ci-workers/tasks/install-brew.yml

@ -0,0 +1,10 @@
---
- name: Check if brew is installed
stat:
path: /usr/local/bin/brew
register: brew_check
- name: Fail if brew is unavailable
fail:
msg: 'brew is not installed! Please install Homebrew: https://docs.brew.sh/Installation.html'
when: not brew_check.stat.exists

23
contrib/ci-workers/templates/buildbot-worker.plist.j2

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>net.buildbot.worker</string>
<key>ProgramArguments</key>
<array>
<string>{{ buildbot_worker_dir }}/venv/bin/buildbot-worker</string>
<string>start</string>
<string>{{ buildbot_worker_name }}</string>
</array>
<key>WorkingDirectory</key>
<string>{{ buildbot_worker_dir }}</string>
<key>UserName</key>
<string>{{ buildbot_worker_user }}</string>
<key>KeepAlive</key>
<dict>
<key>NetworkState</key>
<true/>
</dict>
</dict>
</plist>

38
contrib/ci-workers/unix.yml

@ -72,6 +72,10 @@
package_deps: "{{ buildbot_deps + fetch_deps + conf_deps + build_deps + link_deps + dist_deps }}"
python_modules: "{{ buildbot_modules + rpc_test_modules }}"
- name: Install Homebrew [MacOSX]
include: tasks/install-brew.yml
when: ansible_distribution == 'MacOSX'
- name: Update rolling release [Arch Linux]
pacman:
update_cache: yes
@ -83,15 +87,17 @@
name: "{{ item }}"
state: present
with_items: "{{ package_deps }}"
become_user: "{{ ansible_ssh_user if ansible_distribution == 'MacOSX' else 'root' }}"
- name: Install pip [CentOS]
- name: Install pip [CentOS, MacOSX]
include: tasks/install-pip.yml
when: ansible_distribution == 'CentOS'
when: ansible_distribution in ['CentOS', 'MacOSX']
- name: Install required Python system modules
pip:
name: "{{ item }}"
state: latest
executable: "{{ '/usr/local/bin/pip' if ansible_distribution == 'MacOSX' else omit }}"
with_items: "{{ system_modules }}"
- name: Set up the Buildbot worker user
@ -115,6 +121,7 @@
name: "{{ item }}"
state: latest
virtualenv: "~{{ buildbot_worker_user }}/venv"
virtualenv_command: "{{ '/usr/local/bin/virtualenv' if ansible_distribution == 'MacOSX' else omit }}"
with_items: "{{ python_modules }}"
become_user: "{{ buildbot_worker_user }}"
notify: restart buildbot-worker
@ -133,7 +140,7 @@
content: "{{ buildbot_worker_admin }}"
dest: "~{{ buildbot_worker_user }}/{{ buildbot_worker_name }}/info/admin"
owner: "{{ buildbot_worker_user }}"
group: "{{ buildbot_worker_user }}"
group: "{{ omit if ansible_distribution == 'MacOSX' else buildbot_worker_user }}"
mode: "0644"
- name: Set host details for Buildbot worker
@ -141,7 +148,7 @@
src: "{{ buildbot_worker_host_template }}"
dest: "~{{ buildbot_worker_user }}/{{ buildbot_worker_name }}/info/host"
owner: "{{ buildbot_worker_user }}"
group: "{{ buildbot_worker_user }}"
group: "{{ omit if ansible_distribution == 'MacOSX' else buildbot_worker_user }}"
mode: "0644"
- name: Install custom bashrc for virtualenv
@ -149,7 +156,7 @@
src: bashrc
dest: "~{{ buildbot_worker_user }}/.bashrc"
owner: "{{ buildbot_worker_user }}"
group: "{{ buildbot_worker_user }}"
group: "{{ omit if ansible_distribution == 'MacOSX' else buildbot_worker_user }}"
mode: "0644"
- name: Copy Buildbot worker systemd service unit
@ -159,13 +166,32 @@
owner: root
group: root
mode: "0644"
when: ansible_distribution != 'MacOSX'
notify: reload systemd
- name: Start Buildbot worker.
- name: Copy Buildbot worker launchd service unit
template:
src: templates/buildbot-worker.plist.j2
dest: "/Library/LaunchDaemons/net.buildbot.worker.plist"
owner: root
group: wheel
mode: "0644"
when: ansible_distribution == 'MacOSX'
- name: Start Buildbot worker
service:
name: buildbot-worker
state: started
enabled: yes
when: ansible_distribution != 'MacOSX'
- name: Load Buildbot worker service [MacOSX]
command: launchctl load /Library/LaunchDaemons/net.buildbot.worker.plist
when: ansible_distribution == 'MacOSX'
- name: Start Buildbot worker [MacOSX]
command: launchctl start net.buildbot.worker
when: ansible_distribution == 'MacOSX'
handlers:
- name: restart buildbot-worker

5
contrib/ci-workers/vars/MacOSX.yml

@ -0,0 +1,5 @@
---
buildbot_deps:
- coreutils # For gnproc etc.
# Already installed
build_deps: []
Loading…
Cancel
Save