From 4a013d6d69dda656ca11cc6ede0fd2444afae051 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Fri, 7 Jul 2017 16:52:40 -0700 Subject: [PATCH] Add RHEL 7.3 to ansible-test and CI. (#26550) * Add support for RHEL to ansible-test. * Enable RHEL 7.3 on Shippable. --- shippable.yml | 2 ++ test/runner/completion/remote.txt | 1 + test/runner/lib/core_ci.py | 1 + test/runner/lib/manage_ci.py | 2 ++ test/runner/setup/remote.sh | 40 ++++++++++++++++++++++++------- test/utils/shippable/rhel.sh | 14 +++++++++++ 6 files changed, 51 insertions(+), 9 deletions(-) create mode 100755 test/utils/shippable/rhel.sh diff --git a/shippable.yml b/shippable.yml index b13c12dfa32..15da9e3544f 100644 --- a/shippable.yml +++ b/shippable.yml @@ -20,6 +20,8 @@ matrix: - env: TEST=freebsd/10.3-STABLE - env: TEST=freebsd/11.0-STABLE + - env: TEST=rhel/7.3 + - env: TEST=windows/1 - env: TEST=windows/2 - env: TEST=windows/3 diff --git a/test/runner/completion/remote.txt b/test/runner/completion/remote.txt index 9dca305db4e..c6f34903186 100644 --- a/test/runner/completion/remote.txt +++ b/test/runner/completion/remote.txt @@ -1,3 +1,4 @@ freebsd/10.3-STABLE freebsd/11.0-STABLE osx/10.11 +rhel/7.3 diff --git a/test/runner/lib/core_ci.py b/test/runner/lib/core_ci.py index 43487b3eca6..826c332b755 100644 --- a/test/runner/lib/core_ci.py +++ b/test/runner/lib/core_ci.py @@ -58,6 +58,7 @@ class AnsibleCoreCI(object): 'aws', 'windows', 'freebsd', + 'rhel', 'vyos', 'junos', 'ios', diff --git a/test/runner/lib/manage_ci.py b/test/runner/lib/manage_ci.py index b36d244b0b3..d1063e4029b 100644 --- a/test/runner/lib/manage_ci.py +++ b/test/runner/lib/manage_ci.py @@ -116,6 +116,8 @@ class ManagePosixCI(object): self.become = ['su', '-l', 'root', '-c'] elif self.core_ci.platform == 'osx': self.become = ['sudo', '-in', 'PATH=/usr/local/bin:$PATH'] + elif self.core_ci.platform == 'rhel': + self.become = ['sudo', '-in', 'bash', '-c'] def setup(self): """Start instance and wait for it to become ready and respond to an ansible ping.""" diff --git a/test/runner/setup/remote.sh b/test/runner/setup/remote.sh index 13eb1cbc74c..8c3198c74af 100644 --- a/test/runner/setup/remote.sh +++ b/test/runner/setup/remote.sh @@ -28,21 +28,39 @@ if [ "${platform}" = "freebsd" ]; then subversion \ sudo \ zip +elif [ "${platform}" = "rhel" ]; then + yum update -y + + yum install -y \ + gcc \ + git \ + mercurial \ + python-devel \ + python-jinja2 \ + python-virtualenv \ + python2-cryptography \ + rubygems \ + subversion \ + unzip \ + + pip --version 2>/dev/null || curl --silent --show-error https://bootstrap.pypa.io/get-pip.py | python fi -pip install virtualenv +if [ "${platform}" = "freebsd" ] || [ "${platform}" = "osx" ]; then + pip install virtualenv -# Tests assume loopback addresses other than 127.0.0.1 will work. -# Add aliases for loopback addresses used by tests. + # Tests assume loopback addresses other than 127.0.0.1 will work. + # Add aliases for loopback addresses used by tests. -for i in 3 4 254; do - ifconfig lo0 alias "127.0.0.${i}" up -done + for i in 3 4 254; do + ifconfig lo0 alias "127.0.0.${i}" up + done -ifconfig lo0 + ifconfig lo0 +fi # Since tests run as root, we also need to be able to ssh to localhost as root. -sed -i '' 's/^# *PermitRootLogin.*$/PermitRootLogin yes/;' /etc/ssh/sshd_config +sed -i= 's/^# *PermitRootLogin.*$/PermitRootLogin yes/;' /etc/ssh/sshd_config if [ "${platform}" = "freebsd" ]; then # Restart sshd for configuration changes and loopback aliases to work. @@ -65,5 +83,9 @@ fi cat << EOF > ~/.bashrc alias ls='ls -G' export PS1='\[\e]0;\u@\h: \w\a\]\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' -cd ~/ansible/ EOF + +# Make sure ~/ansible/ is the starting directory for interactive shells. +if [ "${platform}" = "osx" ]; then + echo "cd ~/ansible/" >> ~/.bashrc +fi diff --git a/test/utils/shippable/rhel.sh b/test/utils/shippable/rhel.sh new file mode 100755 index 00000000000..1410abeddf0 --- /dev/null +++ b/test/utils/shippable/rhel.sh @@ -0,0 +1,14 @@ +#!/bin/bash -eux + +set -o pipefail + +declare -a args +IFS='/:' read -ra args <<< "${TEST}" + +platform="${args[0]}" +version="${args[1]}" +target="posix/ci/" + +# shellcheck disable=SC2086 +ansible-test integration --color -v --retry-on-error "${target}" --remote "${platform}/${version}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} \ + --exclude "posix/ci/cloud/"