From 0b0553ea3757bac293508fbd508dc9159a6433c5 Mon Sep 17 00:00:00 2001 From: Scott Fryer <60462088+steelhead31@users.noreply.github.com> Date: Fri, 3 May 2024 17:01:59 +0100 Subject: [PATCH] UnixPB: Only Install CMake on mac where not already present. (#3544) * UnixPB: Only Install CMake on mac where not already present. * GHA: Fix keyserver name resolution * Syntax fix * Syntax fix * Test * Fix path * Test alt solution * Test 2 * Revert test * Update ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/MacOSX.yml Co-authored-by: Martijn Verburg * Add comment about why this fix is needed. * GHA: replace macos11 with macos13 Replace macos11 with 13, and improve cmake check logic --------- Co-authored-by: Martijn Verburg --- .github/workflows/build_mac.yml | 11 ++++++++-- .../roles/Common/tasks/MacOSX.yml | 20 +++++++++++++++++++ .../roles/Common/vars/MacOSX.yml | 1 - .../package_signature_verification.sh | 2 +- 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_mac.yml b/.github/workflows/build_mac.yml index 9448e9f08b..3fecc74835 100644 --- a/.github/workflows/build_mac.yml +++ b/.github/workflows/build_mac.yml @@ -5,7 +5,7 @@ on: paths: - .github/workflows/build_mac.yml - ansible/playbooks/AdoptOpenJDK_Unix_Playbook/** - branches: + branches: - master permissions: @@ -18,7 +18,7 @@ jobs: strategy: matrix: include: - - os: [macos-11] + - os: [macos-13] - os: [macos-14] steps: @@ -27,6 +27,13 @@ jobs: - name: Install dependencies run: brew install ansible + # This is to fix an issue with the github macos14 runner, that cant resolve keyserver.ubuntu.com + # but this does work when replaced with the IP address. Spotted during the GPG verification of ANT step + # Upstream Bug : https://github.com/actions/runner-images/issues/9777 + - name: Replace keyserver address with IP address + run: | + sed -i '' 's/keyserver\.ubuntu\.com/185.125.188.27/g' ansible/playbooks/Supporting_Scripts/package_signature_verification.sh + - name: Run Ansible Playbook run: | echo "localhost ansible_user=runner ansible_connection=local" > ansible/hosts diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/MacOSX.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/MacOSX.yml index 4b4dbb0773..ef2aa43b5e 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/MacOSX.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/tasks/MacOSX.yml @@ -125,6 +125,26 @@ with_items: "{{ Build_Tool_Packages }}" tags: build_tools +# Install CMAKE Where It Doesn't exist +- name: Check if cmake is installed in /opt/homebrew/bin + stat: + path: /opt/homebrew/bin/cmake + register: cmake_homebrew + +- name: Check if cmake is installed in /usr/local/bin + stat: + path: /usr/local/bin/cmake + register: cmake_local + +- name: Install Cmake + become: yes + become_user: "{{ ansible_user }}" + homebrew: + name: "cmake" + state: present + tags: build_tools + when: not (cmake_homebrew.stat.exists or cmake_local.stat.exists) + - name: Install Build Tool Packages NOT macOS 10.12 become: yes become_user: "{{ ansible_user }}" diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/vars/MacOSX.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/vars/MacOSX.yml index 1b5f24865c..be418e5063 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/vars/MacOSX.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Common/vars/MacOSX.yml @@ -8,7 +8,6 @@ Build_Tool_Packages: - autoconf - automake # for compiling freetype on JDK8u - - cmake # OpenJ9 - coreutils - gnupg - gnu-sed diff --git a/ansible/playbooks/Supporting_Scripts/package_signature_verification.sh b/ansible/playbooks/Supporting_Scripts/package_signature_verification.sh index 141faf32f6..6bd1c0d5d3 100755 --- a/ansible/playbooks/Supporting_Scripts/package_signature_verification.sh +++ b/ansible/playbooks/Supporting_Scripts/package_signature_verification.sh @@ -37,7 +37,7 @@ while [[ $# -gt 0 ]]; do ;; -k) KEY="$2" - shift 2 + shift 2 ;; -*|--*) echo "Unknown option $1"