mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Adding docker container capabilities to Travis
This commit is contained in:
parent
80b10bd669
commit
92dcad8e99
4 changed files with 109 additions and 16 deletions
28
.travis.yml
28
.travis.yml
|
@ -1,16 +1,20 @@
|
||||||
sudo: false
|
sudo: required
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
language: python
|
language: python
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- env: TOXENV=py24 INTEGRATION=no
|
- env: TARGET=sanity TOXENV=py24
|
||||||
- env: TOXENV=py26 INTEGRATION=yes
|
- env: TARGET=sanity TOXENV=py26
|
||||||
python: 2.6
|
python: 2.6
|
||||||
- env: TOXENV=py27 INTEGRATION=yes
|
- env: TARGET=sanity TOXENV=py27
|
||||||
python: 2.7
|
python: 2.7
|
||||||
- env: TOXENV=py34 INTEGRATION=no
|
- env: TARGET=sanity TOXENV=py34
|
||||||
python: 3.4
|
python: 3.4
|
||||||
- env: TOXENV=py35 INTEGRATION=no
|
- env: TARGET=sanity TOXENV=py35
|
||||||
python: 3.5
|
python: 3.5
|
||||||
|
- env: TARGET=centos7 TARGET_OPTIONS="--volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
||||||
|
- env: TARGET=ubuntu1404
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
|
@ -18,16 +22,8 @@ addons:
|
||||||
packages:
|
packages:
|
||||||
- python2.4
|
- python2.4
|
||||||
install:
|
install:
|
||||||
- pip install tox PyYAML Jinja2 sphinx
|
- pip install tox
|
||||||
script:
|
script:
|
||||||
# urllib2's defaults are not secure enough for us
|
- ./test/utils/run_tests.sh
|
||||||
- ./test/code-smell/replace-urlopen.sh .
|
|
||||||
- ./test/code-smell/use-compat-six.sh lib
|
|
||||||
- ./test/code-smell/boilerplate.sh
|
|
||||||
- ./test/code-smell/required-and-default-attributes.sh
|
|
||||||
- if test x"$TOXENV" != x'py24' ; then tox ; fi
|
|
||||||
- if test x"$TOXENV" = x'py24' ; then python2.4 -V && python2.4 -m compileall -fq -x 'module_utils/(a10|rax|openstack|ec2|gce).py' lib/ansible/module_utils ; fi
|
|
||||||
#- make -C docsite all
|
|
||||||
- if test x"$INTEGRATION" = x'yes' ; then source ./hacking/env-setup && cd test/integration/ && make parsing && make test_var_precedence && make unicode ; fi
|
|
||||||
after_success:
|
after_success:
|
||||||
- coveralls
|
- coveralls
|
||||||
|
|
48
test/utils/docker/centos7/Dockerfile
Normal file
48
test/utils/docker/centos7/Dockerfile
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
# Latest version of centos
|
||||||
|
FROM centos:centos7
|
||||||
|
ENV LC_ALL en_US.UTF-8
|
||||||
|
|
||||||
|
#RUN yum -y swap fakesystemd systemd
|
||||||
|
RUN yum -y update; yum clean all; yum -y swap fakesystemd systemd
|
||||||
|
|
||||||
|
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
|
||||||
|
rm -f /lib/systemd/system/multi-user.target.wants/*; \
|
||||||
|
rm -f /etc/systemd/system/*.wants/*; \
|
||||||
|
rm -f /lib/systemd/system/local-fs.target.wants/*; \
|
||||||
|
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
|
||||||
|
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
|
||||||
|
rm -f /lib/systemd/system/basic.target.wants/*; \
|
||||||
|
rm -f /lib/systemd/system/anaconda.target.wants/*;
|
||||||
|
|
||||||
|
RUN yum -y install \
|
||||||
|
dbus-python \
|
||||||
|
epel-release \
|
||||||
|
git \
|
||||||
|
make \
|
||||||
|
mercurial \
|
||||||
|
rubygems \
|
||||||
|
subversion \
|
||||||
|
sudo \
|
||||||
|
unzip \
|
||||||
|
which
|
||||||
|
|
||||||
|
RUN yum -y install \
|
||||||
|
PyYAML \
|
||||||
|
python-coverage \
|
||||||
|
python-httplib2 \
|
||||||
|
python-jinja2 \
|
||||||
|
python-keyczar \
|
||||||
|
python-mock \
|
||||||
|
python-nose \
|
||||||
|
python-paramiko \
|
||||||
|
python-pip \
|
||||||
|
python-setuptools \
|
||||||
|
python-virtualenv
|
||||||
|
|
||||||
|
RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers
|
||||||
|
RUN mkdir /etc/ansible/
|
||||||
|
RUN echo -e '[local]\nlocalhost' > /etc/ansible/hosts
|
||||||
|
|
||||||
|
VOLUME /sys/fs/cgroup /run /tmp
|
||||||
|
ENV container=docker
|
||||||
|
CMD ["/usr/sbin/init"]
|
34
test/utils/docker/ubuntu1404/Dockerfile
Normal file
34
test/utils/docker/ubuntu1404/Dockerfile
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
FROM ubuntu:trusty
|
||||||
|
ENV LC_ALL en_US.UTF-8
|
||||||
|
|
||||||
|
RUN apt-get clean; apt-get update -y;
|
||||||
|
|
||||||
|
RUN apt-get install -y \
|
||||||
|
debianutils \
|
||||||
|
git \
|
||||||
|
make \
|
||||||
|
mercurial \
|
||||||
|
ruby \
|
||||||
|
subversion \
|
||||||
|
sudo \
|
||||||
|
unzip
|
||||||
|
|
||||||
|
RUN apt-get install -y \
|
||||||
|
python-coverage \
|
||||||
|
python-httplib2 \
|
||||||
|
python-jinja2 \
|
||||||
|
python-keyczar \
|
||||||
|
python-mock \
|
||||||
|
python-nose \
|
||||||
|
python-paramiko \
|
||||||
|
python-pip \
|
||||||
|
python-setuptools \
|
||||||
|
python-virtualenv \
|
||||||
|
python-yaml
|
||||||
|
|
||||||
|
RUN sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers
|
||||||
|
RUN mkdir /etc/ansible/
|
||||||
|
RUN echo -e '[local]\nlocalhost' > /etc/ansible/hosts
|
||||||
|
|
||||||
|
VOLUME /sys/fs/cgroup /run /tmp
|
||||||
|
ENV container=docker
|
15
test/utils/run_tests.sh
Executable file
15
test/utils/run_tests.sh
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/sh -x
|
||||||
|
|
||||||
|
if [ "${TARGET}" = "sanity" ]; then
|
||||||
|
./test/code-smell/replace-urlopen.sh .
|
||||||
|
./test/code-smell/use-compat-six.sh lib
|
||||||
|
./test/code-smell/boilerplate.sh
|
||||||
|
./test/code-smell/required-and-default-attributes.sh
|
||||||
|
if test x"$TOXENV" != x'py24' ; then tox ; fi
|
||||||
|
if test x"$TOXENV" = x'py24' ; then python2.4 -V && python2.4 -m compileall -fq -x 'module_utils/(a10|rax|openstack|ec2|gce).py' lib/ansible/module_utils ; fi
|
||||||
|
else
|
||||||
|
docker build -t ansible_test/${TARGET} test/utils/docker/${TARGET}
|
||||||
|
docker run -d --volume="${PWD}:/root/ansible" ${TARGET_OPTIONS} ansible_test/${TARGET} > /tmp/cid_${TARGET}
|
||||||
|
docker exec -ti $(cat /tmp/cid_${TARGET}) /bin/sh -c 'cd /root/ansible; . hacking/env-setup; make tests && (cd test/integration; make)'
|
||||||
|
docker kill $(cat /tmp/cid_${TARGET})
|
||||||
|
fi
|
Loading…
Reference in a new issue