1717 MONGODB_VERSION=2.6
1818 - >
1919 DISTRIBUTION=ubuntu-upstart
20- DIST_VERSION=12.04
20+ DIST_VERSION=12.04-builded
2121 MONGODB_VERSION=3.2
2222 - >
2323 DISTRIBUTION=ubuntu-upstart
24- DIST_VERSION=12.04
24+ DIST_VERSION=12.04-builded
2525 MONGODB_VERSION=3.0
2626 - >
2727 DISTRIBUTION=ubuntu-upstart
28- DIST_VERSION=12.04
28+ DIST_VERSION=12.04-builded
2929 MONGODB_VERSION=2.6
30- # - >
31- # distribution=ubuntu-upstart
32- # version=12.04
33- # - >
34- # distribution=debian
35- # version=7
3630
3731services :
3832 - docker
@@ -44,17 +38,22 @@ before_install:
4438 - sudo apt-get update
4539 - sudo apt-get install ansible python-pip -y
4640 - 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
4946 - sudo ln -s ${PWD} /etc/ansible/roles/greendayonfire.mongodb
5047
5148script :
5249 # 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}
5453 # Idempotence test
5554 - >
5655 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'
5857 && (echo 'Idempotence test: pass' && exit 0)
5958 || (echo 'Idempotence test: fail' && exit 1)
6059
@@ -63,11 +62,11 @@ script:
6362
6463 # Test 2
6564 - >
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}
6766 -e mongodb_version=${MONGODB_VERSION} -e mongodb_security_authorization='enabled'
6867 # Idempotence test
6968 - >
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}
7170 -e mongodb_version=${MONGODB_VERSION} -e mongodb_security_authorization='enabled'
7271 | grep -q 'changed=0.*failed=0'
7372 && (echo 'Idempotence test: pass' && exit 0)
@@ -78,11 +77,11 @@ script:
7877
7978 # Test 3
8079 - >
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}
8281 -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs'
8382 # Idempotence test
8483 - >
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}
8685 -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs'
8786 | grep -q 'changed=0.*failed=0'
8887 && (echo 'Idempotence test: pass' && exit 0)
@@ -93,12 +92,12 @@ script:
9392
9493 # Test 4
9594 - >
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}
9796 -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs'
9897 -e mongodb_security_authorization='enabled'
9998 # Idempotence test
10099 - >
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}
102101 -e mongodb_version=${MONGODB_VERSION} -e mongodb_replication_replset='testrs'
103102 -e mongodb_security_authorization='enabled'
104103 | grep -q 'changed=0.*failed=0'
0 commit comments