This repository has been archived by the owner on Sep 25, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy path.travis.yml
70 lines (56 loc) · 2.29 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
sudo: required
language: generic
env:
global:
# https://github.com/travis-ci/travis-ci/issues/6461#issuecomment-239577307
DOCKER_VERSION: "1.9.1-0~trusty"
matrix:
- distribution: ubuntu
version: 14.04
init: /sbin/init
run_opts: ""
- distribution: ubuntu
version: 16.04
init: /bin/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
# - distribution: centos
# version: 6
# init: /sbin/init
# run_opts: ""
# - distribution: centos
# version: 7
# init: /usr/lib/systemd/systemd
# run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
services:
- docker
before_install:
# 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"
# Build container
- docker pull ${distribution}:${version}
- docker build --rm=true --file=tests/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible tests
script:
- container_id=$(mktemp)
# Run container in detached state
- docker run --cap-add IPC_LOCK --detach --volume="${PWD}":/etc/ansible/roles/ansible-vault:ro ${run_opts} ${distribution}-${version}:ansible "${init}" > "${container_id}"
# Display Ansible version
- docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible --version
# Basic role syntax check
- docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/ansible-vault/tests/test.yml --syntax-check
# Run the role/playbook with ansible-playbook
- docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/ansible-vault/tests/test.yml
# Run the role/playbook again, checking to make sure it's idempotent
- >
docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/ansible-vault/tests/test.yml
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
# Playbook specific tests
# ...
# Clean up
- docker stop "$(cat ${container_id})"
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/