17
17
MONGODB_VERSION=2.6
18
18
- >
19
19
DISTRIBUTION=ubuntu-upstart
20
- DIST_VERSION=12.04
20
+ DIST_VERSION=12.04-builded
21
21
MONGODB_VERSION=3.2
22
22
- >
23
23
DISTRIBUTION=ubuntu-upstart
24
- DIST_VERSION=12.04
24
+ DIST_VERSION=12.04-builded
25
25
MONGODB_VERSION=3.0
26
26
- >
27
27
DISTRIBUTION=ubuntu-upstart
28
- DIST_VERSION=12.04
28
+ DIST_VERSION=12.04-builded
29
29
MONGODB_VERSION=2.6
30
- # - >
31
- # distribution=ubuntu-upstart
32
- # version=12.04
33
- # - >
34
- # distribution=debian
35
- # version=7
36
30
37
31
services :
38
32
- docker
@@ -44,17 +38,22 @@ before_install:
44
38
- sudo apt-get update
45
39
- sudo apt-get install ansible python-pip -y
46
40
- sudo pip install docker-py==1.5.0
47
- # Pull docker image
48
- - sudo docker pull ${DISTRIBUTION}:${DIST_VERSION}
41
+ # Pull docker image or build it
42
+ - >
43
+ if [ -f tests/Dockerfile.${DISTRIBUTION}_${DIST_VERSION} ]; then
44
+ sudo docker build --rm=true --file=tests/Dockerfile.${DISTRIBUTION}_${DIST_VERSION}
45
+ --tag ${DISTRIBUTION}:${DIST_VERSION} tests; else sudo docker pull ${DISTRIBUTION}:${DIST_VERSION}; fi
49
46
- sudo ln -s ${PWD} /etc/ansible/roles/greendayonfire.mongodb
50
47
51
48
script :
52
49
# Test 1
53
- - sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e mongodb_version=${MONGODB_VERSION}
50
+ - >
51
+ sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e mongodb_version=${MONGODB_VERSION}
52
+ -e image_name=${DISTRIBUTION}:${DIST_VERSION}
54
53
# Idempotence test
55
54
- >
56
55
sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e mongodb_version=${MONGODB_VERSION}
57
- | grep -q 'changed=0.*failed=0'
56
+ -e image_name=${DISTRIBUTION}:${DIST_VERSION} | grep -q 'changed=0.*failed=0'
58
57
&& (echo 'Idempotence test: pass' && exit 0)
59
58
|| (echo 'Idempotence test: fail' && exit 1)
60
59
@@ -63,11 +62,11 @@ script:
63
62
64
63
# Test 2
65
64
- >
66
- sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1
65
+ sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e image_name=${DISTRIBUTION}:${DIST_VERSION}
67
66
-e mongodb_version=${MONGODB_VERSION} -e mongodb_security_authorization='enabled'
68
67
# Idempotence test
69
68
- >
70
- sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1
69
+ sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo1 -e image_name=${DISTRIBUTION}:${DIST_VERSION}
71
70
-e mongodb_version=${MONGODB_VERSION} -e mongodb_security_authorization='enabled'
72
71
| grep -q 'changed=0.*failed=0'
73
72
&& (echo 'Idempotence test: pass' && exit 0)
@@ -78,11 +77,11 @@ script:
78
77
79
78
# Test 3
80
79
- >
81
- sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo
80
+ sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION}
82
81
-e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs'
83
82
# Idempotence test
84
83
- >
85
- sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo
84
+ sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION}
86
85
-e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs'
87
86
| grep -q 'changed=0.*failed=0'
88
87
&& (echo 'Idempotence test: pass' && exit 0)
@@ -93,12 +92,12 @@ script:
93
92
94
93
# Test 4
95
94
- >
96
- sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo
95
+ sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION}
97
96
-e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs'
98
97
-e mongodb_security_authorization='enabled'
99
98
# Idempotence test
100
99
- >
101
- sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo
100
+ sudo ansible-playbook -i tests/hosts tests/site.yml -e target=mongo -e image_name=${DISTRIBUTION}:${DIST_VERSION}
102
101
-e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs'
103
102
-e mongodb_security_authorization='enabled'
104
103
| grep -q 'changed=0.*failed=0'
0 commit comments