vagrant: Add openSUSE Leap 42.1
Add support for testing ansible roles against openSUSE Leap 42.1. This also improves the run_tests.sh script and also adds support for openSUSE bindep dependencies. Finally, it adds a new BINDEP_FILE variable which can be used to set an alternative bindep.txt dependency file. Change-Id: I57357b119eb1d8eb7726401b8feb48d1ae08c470
This commit is contained in:
parent
ce1466e47b
commit
6df06f4200
30
Vagrantfile
vendored
30
Vagrantfile
vendored
@ -1,9 +1,25 @@
|
|||||||
Vagrant.configure(2) do |config|
|
Vagrant.configure(2) do |config|
|
||||||
config.vm.box = "ubuntu/xenial64"
|
config.vm.provider "virtualbox" do |v|
|
||||||
config.vm.provision "shell", inline: <<-SHELL
|
v.memory = 2048
|
||||||
sudo su -
|
v.cpus = 2
|
||||||
cd /vagrant
|
end
|
||||||
apt-get update
|
|
||||||
./run_tests.sh
|
config.vm.define "ubuntu1604" do |xenial|
|
||||||
SHELL
|
xenial.vm.box = "ubuntu/xenial64"
|
||||||
|
xenial.vm.provision "shell", inline: <<-SHELL
|
||||||
|
sudo su -
|
||||||
|
cd /vagrant
|
||||||
|
./run_tests.sh
|
||||||
|
SHELL
|
||||||
|
end
|
||||||
|
|
||||||
|
config.vm.define "opensuse421" do |leap421|
|
||||||
|
leap421.vm.box = "opensuse/openSUSE-42.1-x86_64"
|
||||||
|
leap421.vm.provision "shell", inline: <<-SHELL
|
||||||
|
sudo su -
|
||||||
|
cd /vagrant
|
||||||
|
./run_tests.sh
|
||||||
|
SHELL
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
20
bindep.txt
20
bindep.txt
@ -18,26 +18,26 @@ libffi-dev [platform:dpkg]
|
|||||||
python2.7 [platform:dpkg]
|
python2.7 [platform:dpkg]
|
||||||
python-dev [platform:dpkg]
|
python-dev [platform:dpkg]
|
||||||
|
|
||||||
# Base requirements for CentOS
|
# Base requirements for RPM distros
|
||||||
gcc [platform:rpm]
|
gcc [platform:rpm]
|
||||||
gcc-c++ [platform:rpm]
|
gcc-c++ [platform:rpm]
|
||||||
git [platform:rpm]
|
git [platform:rpm]
|
||||||
python-devel [platform:rpm]
|
|
||||||
libffi-devel [platform:rpm]
|
libffi-devel [platform:rpm]
|
||||||
openssl-devel [platform:rpm]
|
openssl-devel [platform:rpm]
|
||||||
|
python-devel [platform:rpm]
|
||||||
|
|
||||||
# For SELinux
|
# For SELinux
|
||||||
libselinux-python [platform:rpm]
|
libselinux-python [platform:centos]
|
||||||
|
libsemanage-python [platform:centos]
|
||||||
|
|
||||||
# For SSL SNI support
|
# For SSL SNI support
|
||||||
python-pyasn1 [platform:dpkg]
|
python-pyasn1 [platform:dpkg platform:suselinux]
|
||||||
python-openssl [platform:dpkg]
|
python-openssl [platform:dpkg platform:suselinux]
|
||||||
python-ndg-httpsclient [platform:ubuntu]
|
python-ndg-httpsclient [platform:ubuntu]
|
||||||
python2-pyasn1 [platform:rpm]
|
python2-pyasn1 [platform:centos]
|
||||||
python2-pyOpenSSL [platform:rpm]
|
python2-pyOpenSSL [platform:centos]
|
||||||
python-ndg_httpsclient [platform:rpm]
|
python-pyOpenSSL [platform:suselinux]
|
||||||
|
python-ndg_httpsclient [platform:centos]
|
||||||
|
|
||||||
|
|
||||||
# Required for compressing collected log files in CI
|
# Required for compressing collected log files in CI
|
||||||
gzip
|
gzip
|
||||||
|
83
run_tests.sh
83
run_tests.sh
@ -13,23 +13,37 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
set -o pipefail
|
||||||
set -euov
|
set -euov
|
||||||
|
|
||||||
FUNCTIONAL_TEST=${FUNCTIONAL_TEST:-true}
|
BINDEP_FILE=${BINDEP_FILE:-bindep.txt}
|
||||||
|
|
||||||
# Install python2 for Ubuntu 16.04 and CentOS 7
|
# Start fresh
|
||||||
if which apt-get; then
|
rm -rf .tox
|
||||||
sudo apt-get update && sudo apt-get install -y python
|
|
||||||
fi
|
|
||||||
|
|
||||||
if which yum; then
|
source /etc/os-release || source /usr/lib/os-release
|
||||||
sudo yum install -y python
|
|
||||||
fi
|
case "${ID,,}" in
|
||||||
|
*suse*)
|
||||||
|
# Need to pull libffi and python-pyOpenSSL early
|
||||||
|
# because we install ndg-httpsclient from pip
|
||||||
|
sudo zypper -n in python-devel lsb-release libffi-devel python-pyOpenSSL
|
||||||
|
;;
|
||||||
|
centos)
|
||||||
|
sudo yum install -y python-devel redhat-lsb-core
|
||||||
|
;;
|
||||||
|
ubuntu|debian)
|
||||||
|
sudo apt-get update && sudo apt-get install -y python-dev lsb-release
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unsupported distribution: ${ID,,}"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
|
||||||
# Install pip
|
# Install pip
|
||||||
if [ ! "$(which pip)" ]; then
|
if ! which pip &>/dev/null; then
|
||||||
curl --silent --show-error --retry 5 \
|
curl --silent --show-error --retry 5 \
|
||||||
https://bootstrap.pypa.io/get-pip.py | sudo python2.7
|
https://bootstrap.pypa.io/get-pip.py | sudo python2.7
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install bindep and tox
|
# Install bindep and tox
|
||||||
@ -38,25 +52,40 @@ sudo pip install bindep tox
|
|||||||
# CentOS 7 requires two additional packages:
|
# CentOS 7 requires two additional packages:
|
||||||
# redhat-lsb-core - for bindep profile support
|
# redhat-lsb-core - for bindep profile support
|
||||||
# epel-release - required to install python-ndg_httpsclient/python2-pyasn1
|
# epel-release - required to install python-ndg_httpsclient/python2-pyasn1
|
||||||
if [ "$(which yum)" ]; then
|
if [[ ${ID,,} == "centos" ]]; then
|
||||||
sudo yum -y install redhat-lsb-core epel-release
|
sudo yum -y install redhat-lsb-core epel-release
|
||||||
|
# openSUSE 42.1 does not have python-ndg-httpsclient
|
||||||
|
elif [[ ${ID,,} == *suse* ]]; then
|
||||||
|
pip install ndg-httpsclient
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Get a list of packages to install with bindep. If packages need to be
|
||||||
|
# installed, bindep exits with an exit code of 1.
|
||||||
|
BINDEP_PKGS=$(bindep -b -f ${BINDEP_FILE} test || true)
|
||||||
|
echo "Packages to install: ${BINDEP_PKGS}"
|
||||||
|
|
||||||
# Install OS packages using bindep
|
# Install OS packages using bindep
|
||||||
if apt-get -v >/dev/null 2>&1 ; then
|
if [[ ${#BINDEP_PKGS} > 0 ]]; then
|
||||||
sudo apt-get update
|
case "${ID,,}" in
|
||||||
DEBIAN_FRONTEND=noninteractive \
|
*suse*)
|
||||||
sudo apt-get -q --option "Dpkg::Options::=--force-confold" \
|
sudo zypper -n in $BINDEP_PKGS
|
||||||
--assume-yes install `bindep -b -f bindep.txt test`
|
;;
|
||||||
else
|
centos)
|
||||||
sudo yum install -y `bindep -b -f bindep.txt test`
|
sudo yum install -y $BINDEP_PKGS
|
||||||
|
;;
|
||||||
|
ubuntu|debian)
|
||||||
|
sudo apt-get update
|
||||||
|
DEBIAN_FRONTEND=noninteractive \
|
||||||
|
sudo apt-get -q --option "Dpkg::Options::=--force-confold" \
|
||||||
|
--assume-yes install $BINDEP_PKGS
|
||||||
|
;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# run through each tox env and execute the test
|
# Get envlist in a $env1,$env2,...,$envn format
|
||||||
for tox_env in $(awk -F= '/envlist/ {print $2}' tox.ini | sed 's/,/ /g'); do
|
toxenvs="$(tox -l | tr '\n' ',' | sed 's/,$//')"
|
||||||
if [ "${tox_env}" != "functional" ]; then
|
|
||||||
tox -e ${tox_env}
|
# Execute all $toxenvs or only a specific one
|
||||||
elif [ "${tox_env}" == "functional" ] && [ "${FUNCTIONAL_TEST}" == "true" ]; then
|
tox -e "${1:-$toxenvs}"
|
||||||
tox -e ${tox_env}
|
|
||||||
fi
|
# vim: set ts=4 sw=4 expandtab:
|
||||||
done
|
|
||||||
|
Loading…
Reference in New Issue
Block a user