From 33c4876d51f19a5381ca1dbdde5c77f311a5b5fb Mon Sep 17 00:00:00 2001 From: Bert Van Vreckem Date: Sat, 12 Dec 2015 13:36:52 +0100 Subject: [PATCH] Fix docker run on Ubuntu --- .travis.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1582316..c571912 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,17 +19,24 @@ script: # Run test playbook on Ubuntu container # + # Run container in detached state + - sudo docker run --detach ubuntu:ansible /sbin/init > "${CONTAINER_ID}" + + # Syntax check - - sudo docker run ubuntu:ansible ansible-playbook /etc/ansible/test.yml --syntax-check + - sudo docker exec "$(cat ${CONTAINER_ID})" ansible-playbook /etc/ansible/test.yml --syntax-check # Test role - - sudo docker run ubuntu:ansible ansible-playbook /etc/ansible/test.yml + - sudo docker exec "$(cat ${CONTAINER_ID})" ansible-playbook /etc/ansible/test.yml # Idempotence test - > - sudo docker run ubuntu:ansible ansible-playbook /etc/ansible/test.yml + sudo docker exec "$(cat ${CONTAINER_ID})" ansible-playbook /etc/ansible/test.yml | grep -q 'changed=0.*failed=0' && (echo 'Idempotence test: pass' && exit 0) || (echo 'Idempotence test: fail' && exit 1) + # Clean up + - sudo docker stop "$(cat ${CONTAINER_ID})" + # # Run test playbook on CentOS container #