Merge "vagrant: Add openSUSE Leap 42.1"

This commit is contained in:
Jenkins 2017-03-30 13:39:10 +00:00 committed by Gerrit Code Review
commit 7900243cbb
3 changed files with 89 additions and 44 deletions

30
Vagrantfile vendored
View File

@ -1,9 +1,25 @@
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.provision "shell", inline: <<-SHELL
sudo su -
cd /vagrant
apt-get update
./run_tests.sh
SHELL
config.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
end
config.vm.define "ubuntu1604" do |xenial|
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

View File

@ -18,26 +18,26 @@ libffi-dev [platform:dpkg]
python2.7 [platform:dpkg]
python-dev [platform:dpkg]
# Base requirements for CentOS
# Base requirements for RPM distros
gcc [platform:rpm]
gcc-c++ [platform:rpm]
git [platform:rpm]
python-devel [platform:rpm]
libffi-devel [platform:rpm]
openssl-devel [platform:rpm]
python-devel [platform:rpm]
# For SELinux
libselinux-python [platform:rpm]
libselinux-python [platform:centos]
libsemanage-python [platform:centos]
# For SSL SNI support
python-pyasn1 [platform:dpkg]
python-openssl [platform:dpkg]
python-pyasn1 [platform:dpkg platform:suselinux]
python-openssl [platform:dpkg platform:suselinux]
python-ndg-httpsclient [platform:ubuntu]
python2-pyasn1 [platform:rpm]
python2-pyOpenSSL [platform:rpm]
python-ndg_httpsclient [platform:rpm]
python2-pyasn1 [platform:centos]
python2-pyOpenSSL [platform:centos]
python-pyOpenSSL [platform:suselinux]
python-ndg_httpsclient [platform:centos]
# Required for compressing collected log files in CI
gzip

View File

@ -13,23 +13,37 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set -o pipefail
set -euov
FUNCTIONAL_TEST=${FUNCTIONAL_TEST:-true}
BINDEP_FILE=${BINDEP_FILE:-bindep.txt}
# Install python2 for Ubuntu 16.04 and CentOS 7
if which apt-get; then
sudo apt-get update && sudo apt-get install -y python
fi
# Start fresh
rm -rf .tox
if which yum; then
sudo yum install -y python
fi
source /etc/os-release || source /usr/lib/os-release
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
if [ ! "$(which pip)" ]; then
curl --silent --show-error --retry 5 \
https://bootstrap.pypa.io/get-pip.py | sudo python2.7
if ! which pip &>/dev/null; then
curl --silent --show-error --retry 5 \
https://bootstrap.pypa.io/get-pip.py | sudo python2.7
fi
# Install bindep and tox
@ -38,25 +52,40 @@ sudo pip install bindep tox
# CentOS 7 requires two additional packages:
# redhat-lsb-core - for bindep profile support
# 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
# openSUSE 42.1 does not have python-ndg-httpsclient
elif [[ ${ID,,} == *suse* ]]; then
pip install ndg-httpsclient
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
if apt-get -v >/dev/null 2>&1 ; then
sudo apt-get update
DEBIAN_FRONTEND=noninteractive \
sudo apt-get -q --option "Dpkg::Options::=--force-confold" \
--assume-yes install `bindep -b -f bindep.txt test`
else
sudo yum install -y `bindep -b -f bindep.txt test`
if [[ ${#BINDEP_PKGS} > 0 ]]; then
case "${ID,,}" in
*suse*)
sudo zypper -n in $BINDEP_PKGS
;;
centos)
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
# run through each tox env and execute the test
for tox_env in $(awk -F= '/envlist/ {print $2}' tox.ini | sed 's/,/ /g'); do
if [ "${tox_env}" != "functional" ]; then
tox -e ${tox_env}
elif [ "${tox_env}" == "functional" ] && [ "${FUNCTIONAL_TEST}" == "true" ]; then
tox -e ${tox_env}
fi
done
# Get envlist in a $env1,$env2,...,$envn format
toxenvs="$(tox -l | tr '\n' ',' | sed 's/,$//')"
# Execute all $toxenvs or only a specific one
tox -e "${1:-$toxenvs}"
# vim: set ts=4 sw=4 expandtab: