Adjust Travis file for easier maintenance.

This commit is contained in:
Jeff Geerling 2016-08-31 20:25:05 -05:00
parent ccfb1fbcb7
commit 0b7cd353c0
2 changed files with 9 additions and 14 deletions

View file

@ -6,24 +6,19 @@ env:
# 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
- distro: centos7
init: /usr/lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
- repository: geerlingguy/docker-centos6-ansible
version: latest
- distro: centos6
init: /sbin/init
run_opts: ""
- repository: geerlingguy/docker-ubuntu1604-ansible
version: latest
- distro: ubuntu1604
init: /lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
- repository: geerlingguy/docker-ubuntu1404-ansible
version: latest
- distro: ubuntu1404
init: /sbin/init
run_opts: ""
- repository: geerlingguy/docker-ubuntu1204-ansible
version: latest
- distro: ubuntu1204
init: /sbin/init
run_opts: ""
@ -37,12 +32,12 @@ before_install:
- sudo apt-get install docker-engine=$DOCKER_VERSION -yq --no-install-suggests --no-install-recommends --force-yes -o Dpkg::Options::="--force-confnew"
# Pull container.
- 'sudo docker pull ${repository}:${version}'
- 'sudo docker pull geerlingguy/docker-${distro}-ansible:latest'
script:
- 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}"'
- 'sudo docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} geerlingguy/docker-${distro}-ansible:latest "${init}" > "${container_id}"'
# 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'
@ -59,7 +54,7 @@ script:
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
# Clean up
# Clean up.
- 'sudo docker stop "$(cat ${container_id})"'
notifications:

View file

@ -121,4 +121,4 @@ MIT / BSD
## Author Information
This role was created in 2014 by [Jeff Geerling](http://jeffgeerling.com/), author of [Ansible for DevOps](http://ansiblefordevops.com/).
This role was created in 2014 by [Jeff Geerling](http://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/).