-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
42 lines (37 loc) · 2.08 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---
sudo: required
env:
- distribution: centos
version: 7
- distribution: ubuntu
version: bionic
- distribution: ubuntu
version: xenial
- distribution: ubuntu
version: trusty
- distribution: debian
version: stretch
- distribution: debian
version: jessie
services:
- docker
before_install:
- 'sudo docker pull ${distribution}:${version}'
- 'sudo docker build --no-cache --rm --file=tests/travis/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible tests/travis'
script:
- container_id=$(mktemp)
- 'sudo docker run --detach --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro --volume="${PWD}":/etc/ansible/roles/proactcloud.admins:ro ${distribution}-${version}:ansible > "${container_id}"'
- 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/proactcloud.admins/tests/travis/test.yml -e @/etc/ansible/roles/proactcloud.admins/tests/travis/create_user_vars.yml --syntax-check'
- 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/proactcloud.admins/tests/travis/test.yml -e @/etc/ansible/roles/proactcloud.admins/tests/travis/create_user_vars.yml'
- >
sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/proactcloud.admins/tests/travis/test.yml -e @/etc/ansible/roles/proactcloud.admins/tests/travis/create_user_vars.yml
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test - create user: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
- 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/proactcloud.admins/tests/travis/test.yml'
- >
sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/proactcloud.admins/tests/travis/test.yml
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test - delete user: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
- 'sudo docker rm -f "$(cat ${container_id})"'