From b77badf432fa25a9ae0859055c80a51443ff65e4 Mon Sep 17 00:00:00 2001 From: Conor Finn Date: Wed, 8 Feb 2023 11:10:10 +0000 Subject: [PATCH] Fix homebrew and git installation RE #62 --- .../ansible/requirements.yml | 3 + .../ansible/roles/agent/tasks/main.yml | 81 +++++++++---------- 2 files changed, 43 insertions(+), 41 deletions(-) create mode 100644 jenkins-node/mantid-builder-macos/ansible/requirements.yml diff --git a/jenkins-node/mantid-builder-macos/ansible/requirements.yml b/jenkins-node/mantid-builder-macos/ansible/requirements.yml new file mode 100644 index 0000000..9357fc7 --- /dev/null +++ b/jenkins-node/mantid-builder-macos/ansible/requirements.yml @@ -0,0 +1,3 @@ +--- +collections: + - name: geerlingguy.mac \ No newline at end of file diff --git a/jenkins-node/mantid-builder-macos/ansible/roles/agent/tasks/main.yml b/jenkins-node/mantid-builder-macos/ansible/roles/agent/tasks/main.yml index 23342fa..c646360 100644 --- a/jenkins-node/mantid-builder-macos/ansible/roles/agent/tasks/main.yml +++ b/jenkins-node/mantid-builder-macos/ansible/roles/agent/tasks/main.yml @@ -1,48 +1,47 @@ --- +# Deploy Jenkins agent on macOS -- name: Deploy Jenkins agent on macOS - tasks: - # Install Requirements +# Install Requirements - - name: Install homebrew - include_role: - name: geerlingguy.mac.homebrew - - - name: Make sure homebrew bin is in the path - ansible.builtin.lineinfile: - path: /etc/paths - state: present - line: '/opt/homebrew/bin' - become: true - become_user: root - - - name: Install git - community.general.homebrew: - name: git - state: latest - - - name: Install Java 11 - community.general.homebrew: - name: java11 - state: present - - # Configure macOS Settings - - - name: Disable screensaver - shell: defaults write com.apple.screensaver idleTime 0 - - - name: Disable saved application states to avoid dialog - shell: defaults write org.python.python NSQuitAlwaysKeepsWindows -bool false +- name: Install homebrew + include_role: + name: geerlingguy.mac.homebrew + +- name: Make sure homebrew bin is in the path + ansible.builtin.lineinfile: + path: /etc/paths + state: present + line: '/opt/homebrew/bin' + become: true + become_user: root + +- name: Install git + community.general.homebrew: + name: git + state: latest + +- name: Install Java 11 + community.general.homebrew: + name: java11 + state: present + +# Configure macOS Settings + +- name: Disable screensaver + shell: defaults write com.apple.screensaver idleTime 0 + +- name: Disable saved application states to avoid dialog + shell: defaults write org.python.python NSQuitAlwaysKeepsWindows -bool false - # TODO: Disable autolock (this seems to change between versions, so might not be possible to script) +# TODO: Disable autolock (this seems to change between versions, so might not be possible to script) - - name: Download jenkins slave script - shell: curl -o ~/jenkins-slave.sh https://raw.githubusercontent.com/mantidproject/mantid/main/buildconfig/Jenkins/jenkins-slave.sh - - - name: Start script as chrontab entry - ansible.builtin.cron: - name: "Run slave script" - minute: "*/5" - job: "$HOME/jenkins-slave.sh {{ agent_name }} {{ agent_secret }}" +- name: Download jenkins slave script + shell: curl -o ~/jenkins-slave.sh https://raw.githubusercontent.com/mantidproject/mantid/main/buildconfig/Jenkins/jenkins-slave.sh + +- name: Start script as chrontab entry + ansible.builtin.cron: + name: "Run slave script" + minute: "*/5" + job: "$HOME/jenkins-slave.sh {{ agent_name }} {{ agent_secret }}"