ansible-role-apache/.travis.yml

67 lines
2.3 KiB
YAML
Raw Normal View History

2016-02-09 06:01:57 +01:00
---
2015-12-12 11:17:40 +01:00
sudo: required
2014-04-22 14:39:07 +02:00
env:
2016-08-29 03:23:31 +02:00
global:
# https://github.com/travis-ci/travis-ci/issues/6461#issuecomment-239577306
DOCKER_VERSION: "1.9.1-0~trusty"
matrix:
- repository: geerlingguy/docker-centos7-ansible
version: latest
init: /usr/lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
- repository: geerlingguy/docker-centos6-ansible
version: latest
init: /sbin/init
run_opts: ""
2016-08-29 03:33:01 +02:00
- repository: geerlingguy/docker-ubuntu1604-ansible
version: latest
init: /lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
2016-08-29 03:23:31 +02:00
- repository: geerlingguy/docker-ubuntu1404-ansible
version: latest
init: /sbin/init
run_opts: ""
- repository: geerlingguy/docker-ubuntu1204-ansible
version: latest
init: /sbin/init
run_opts: ""
2015-12-12 11:17:40 +01:00
services:
- docker
2015-12-12 11:17:40 +01:00
before_install:
2016-08-29 03:23:31 +02:00
# Downgrade to specific version of Docker engine.
- sudo apt-get update
- sudo apt-get remove docker-engine -yq
- sudo apt-get install docker-engine=$DOCKER_VERSION -yq --no-install-suggests --no-install-recommends --force-yes -o Dpkg::Options::="--force-confnew"
# Pull container.
2016-08-29 03:14:10 +02:00
- 'sudo docker pull ${repository}:${version}'
2014-04-22 14:39:07 +02:00
script:
2015-12-14 09:07:17 +01:00
- container_id=$(mktemp)
# Run container in detached state.
- 'sudo docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} ${repository}:${version} "${init}" > "${container_id}"'
2015-12-12 11:17:40 +01:00
# Ansible syntax check.
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml --syntax-check'
# Test role.
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml'
# Test role idempotence.
2016-08-29 05:10:47 +02:00
- idempotence=$(mktemp)
- sudo docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml | tee -a ${idempotence}
2015-12-12 11:29:05 +01:00
- >
2016-08-29 05:10:47 +02:00
tail ${idempotence}
2015-12-12 11:29:05 +01:00
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
# Clean up
- 'sudo docker stop "$(cat ${container_id})"'
2016-02-01 19:21:26 +01:00
notifications:
2016-02-08 20:50:39 +01:00
webhooks: https://galaxy.ansible.com/api/v1/notifications/