Browse code

Add RHEL 7.3 to ansible-test and CI. (#26550)

* Add support for RHEL to ansible-test.
* Enable RHEL 7.3 on Shippable.

Matt Clay authored on 2017/07/08 08:52:40
Showing 6 changed files
... ...
@@ -20,6 +20,8 @@ matrix:
20 20
     - env: TEST=freebsd/10.3-STABLE
21 21
     - env: TEST=freebsd/11.0-STABLE
22 22
 
23
+    - env: TEST=rhel/7.3
24
+
23 25
     - env: TEST=windows/1
24 26
     - env: TEST=windows/2
25 27
     - env: TEST=windows/3
... ...
@@ -1,3 +1,4 @@
1 1
 freebsd/10.3-STABLE
2 2
 freebsd/11.0-STABLE
3 3
 osx/10.11
4
+rhel/7.3
... ...
@@ -58,6 +58,7 @@ class AnsibleCoreCI(object):
58 58
             'aws',
59 59
             'windows',
60 60
             'freebsd',
61
+            'rhel',
61 62
             'vyos',
62 63
             'junos',
63 64
             'ios',
... ...
@@ -116,6 +116,8 @@ class ManagePosixCI(object):
116 116
             self.become = ['su', '-l', 'root', '-c']
117 117
         elif self.core_ci.platform == 'osx':
118 118
             self.become = ['sudo', '-in', 'PATH=/usr/local/bin:$PATH']
119
+        elif self.core_ci.platform == 'rhel':
120
+            self.become = ['sudo', '-in', 'bash', '-c']
119 121
 
120 122
     def setup(self):
121 123
         """Start instance and wait for it to become ready and respond to an ansible ping."""
... ...
@@ -28,21 +28,39 @@ if [ "${platform}" = "freebsd" ]; then
28 28
         subversion \
29 29
         sudo \
30 30
         zip
31
+elif [ "${platform}" = "rhel" ]; then
32
+    yum update -y
33
+
34
+    yum install -y \
35
+        gcc \
36
+        git \
37
+        mercurial \
38
+        python-devel \
39
+        python-jinja2 \
40
+        python-virtualenv \
41
+        python2-cryptography \
42
+        rubygems \
43
+        subversion \
44
+        unzip \
45
+
46
+    pip --version 2>/dev/null || curl --silent --show-error https://bootstrap.pypa.io/get-pip.py | python
31 47
 fi
32 48
 
33
-pip install virtualenv
49
+if [ "${platform}" = "freebsd" ] || [ "${platform}" = "osx" ]; then
50
+    pip install virtualenv
34 51
 
35
-# Tests assume loopback addresses other than 127.0.0.1 will work.
36
-# Add aliases for loopback addresses used by tests.
52
+    # Tests assume loopback addresses other than 127.0.0.1 will work.
53
+    # Add aliases for loopback addresses used by tests.
37 54
 
38
-for i in 3 4 254; do
39
-    ifconfig lo0 alias "127.0.0.${i}" up
40
-done
55
+    for i in 3 4 254; do
56
+        ifconfig lo0 alias "127.0.0.${i}" up
57
+    done
41 58
 
42
-ifconfig lo0
59
+    ifconfig lo0
60
+fi
43 61
 
44 62
 # Since tests run as root, we also need to be able to ssh to localhost as root.
45
-sed -i '' 's/^# *PermitRootLogin.*$/PermitRootLogin yes/;' /etc/ssh/sshd_config
63
+sed -i= 's/^# *PermitRootLogin.*$/PermitRootLogin yes/;' /etc/ssh/sshd_config
46 64
 
47 65
 if [ "${platform}" = "freebsd" ]; then
48 66
     # Restart sshd for configuration changes and loopback aliases to work.
... ...
@@ -65,5 +83,9 @@ fi
65 65
 cat << EOF > ~/.bashrc
66 66
 alias ls='ls -G'
67 67
 export PS1='\[\e]0;\u@\h: \w\a\]\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
68
-cd ~/ansible/
69 68
 EOF
69
+
70
+# Make sure ~/ansible/ is the starting directory for interactive shells.
71
+if [ "${platform}" = "osx" ]; then
72
+    echo "cd ~/ansible/" >> ~/.bashrc
73
+fi
70 74
new file mode 100755
... ...
@@ -0,0 +1,14 @@
0
+#!/bin/bash -eux
1
+
2
+set -o pipefail
3
+
4
+declare -a args
5
+IFS='/:' read -ra args <<< "${TEST}"
6
+
7
+platform="${args[0]}"
8
+version="${args[1]}"
9
+target="posix/ci/"
10
+
11
+# shellcheck disable=SC2086
12
+ansible-test integration --color -v --retry-on-error "${target}" --remote "${platform}/${version}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} \
13
+    --exclude "posix/ci/cloud/"