From 42734436867c4caacd605932d946c698dbbbfa38 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Thu, 27 Aug 2020 12:08:38 -0700 Subject: [PATCH] [stable-2.10] Support macOS 10.15 for ansible-test --remote. Use of this new version is experimental, so it is not enabled in CI yet. (cherry picked from commit 2bbcbe99fdc61a0885eae9d14b4c74883c12601b) Co-authored-by: Matt Clay --- changelogs/fragments/ansible-test-macos-10.15.yml | 2 ++ test/lib/ansible_test/_data/completion/remote.txt | 1 + test/lib/ansible_test/_data/setup/remote.sh | 11 +++++++++++ test/lib/ansible_test/_internal/core_ci.py | 1 + test/lib/ansible_test/_internal/manage_ci.py | 2 ++ 5 files changed, 17 insertions(+) create mode 100644 changelogs/fragments/ansible-test-macos-10.15.yml diff --git a/changelogs/fragments/ansible-test-macos-10.15.yml b/changelogs/fragments/ansible-test-macos-10.15.yml new file mode 100644 index 00000000000..5edc5c944b8 --- /dev/null +++ b/changelogs/fragments/ansible-test-macos-10.15.yml @@ -0,0 +1,2 @@ +minor_changes: + - ansible-test - Add ``macos/10.15`` as a supported value for the ``--remote`` option. diff --git a/test/lib/ansible_test/_data/completion/remote.txt b/test/lib/ansible_test/_data/completion/remote.txt index ddef2c3e555..0ad20538c93 100644 --- a/test/lib/ansible_test/_data/completion/remote.txt +++ b/test/lib/ansible_test/_data/completion/remote.txt @@ -1,6 +1,7 @@ freebsd/11.1 python=2.7,3.6 python_dir=/usr/local/bin freebsd/12.1 python=3.6,2.7 python_dir=/usr/local/bin osx/10.11 python=2.7 python_dir=/usr/local/bin +macos/10.15 python=3.8 python_dir=/usr/local/bin rhel/7.6 python=2.7 rhel/7.8 python=2.7 rhel/8.1 python=3.6 diff --git a/test/lib/ansible_test/_data/setup/remote.sh b/test/lib/ansible_test/_data/setup/remote.sh index f6b537009b6..654f678d385 100644 --- a/test/lib/ansible_test/_data/setup/remote.sh +++ b/test/lib/ansible_test/_data/setup/remote.sh @@ -88,6 +88,14 @@ elif [ "${platform}" = "centos" ]; then done install_pip +elif [ "${platform}" = "macos" ]; then + while true; do + pip3 install --disable-pip-version-check --quiet \ + 'virtualenv<20' \ + && break + echo "Failed to install packages. Sleeping before trying again..." + sleep 10 + done elif [ "${platform}" = "osx" ]; then while true; do pip install --disable-pip-version-check --quiet \ @@ -148,4 +156,7 @@ EOF # Make sure ~/ansible/ is the starting directory for interactive shells. if [ "${platform}" = "osx" ]; then echo "cd ~/ansible/" >> ~/.bashrc +elif [ "${platform}" = "macos" ] ; then + echo "export BASH_SILENCE_DEPRECATION_WARNING=1" >> ~/.bashrc + echo "cd ~/ansible/" >> ~/.bashrc fi diff --git a/test/lib/ansible_test/_internal/core_ci.py b/test/lib/ansible_test/_internal/core_ci.py index b1e9dd9f2ad..dfa42a28670 100644 --- a/test/lib/ansible_test/_internal/core_ci.py +++ b/test/lib/ansible_test/_internal/core_ci.py @@ -111,6 +111,7 @@ class AnsibleCoreCI: 'centos arch=power', # avoid ibmvpc as default for no-arch centos to avoid making centos default to power ), parallels=( + 'macos', 'osx', ), ) diff --git a/test/lib/ansible_test/_internal/manage_ci.py b/test/lib/ansible_test/_internal/manage_ci.py index a1da541171b..e81dad68997 100644 --- a/test/lib/ansible_test/_internal/manage_ci.py +++ b/test/lib/ansible_test/_internal/manage_ci.py @@ -211,6 +211,8 @@ class ManagePosixCI: self.become = ['sudo', '-in', 'sh', '-c'] else: raise NotImplementedError('provider %s has not been implemented' % self.core_ci.provider) + elif self.core_ci.platform == 'macos': + self.become = ['sudo', '-in', 'PATH=/usr/local/bin:$PATH', 'sh', '-c'] elif self.core_ci.platform == 'osx': self.become = ['sudo', '-in', 'PATH=/usr/local/bin:$PATH'] elif self.core_ci.platform == 'rhel' or self.core_ci.platform == 'centos':