From ecd1367d9b0b605ec4b33c79d42aea3f36f16317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20KUBLER?= Date: Mon, 18 Mar 2019 21:11:05 +0100 Subject: [PATCH] Updated Travis CI file. --- .travis.yml | 62 ++++++++++------------------------- molecule/default/INSTALL.rst | 16 --------- molecule/default/molecule.yml | 2 +- molecule/default/playbook.yml | 2 +- 4 files changed, 19 insertions(+), 63 deletions(-) delete mode 100644 molecule/default/INSTALL.rst diff --git a/.travis.yml b/.travis.yml index e4e47c3..f7daab5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,56 +1,28 @@ --- -sudo: required -language: bash +language: python services: - docker # Build matrix env: - - distribution: centos - version: 7 - - distribution: debian - version: 9 - - distribution: ubuntu - version: 16.04 - - distribution: ubuntu - version: 18.04 - -before_install: - # Pull the image corresponding to the environment vars from Docker Hub: - - docker pull "kblr/${distribution}${version}-ansible:latest" + global: + - ROLENAME=chrony + matrix: + - DISTRIBUTION=centos7 + - DISTRIBUTION=debian9 + - DISTRIBUTION=ubuntu16.04 + - DISTRIBUTION=ubuntu18.04 + +install: + - pip install molecule docker + +before_script: + - cd .. + - mv ansible-role-$ROLENAME frzk.$ROLENAME + - cd frzk.$ROLENAME script: - # 0/ Run the container: - - > - docker run - --name "${TRAVIS_COMMIT}.${distribution}-${version}" - --detach - --privileged - --mount type=bind,source=/sys/fs/cgroup,target=/sys/fs/cgroup,readonly - --mount type=bind,source="$(pwd)",target=/etc/ansible/roles/under_test,readonly - "kblr/${distribution}${version}-ansible:latest" - - # 1/ Check role syntax: - - > - docker exec "${TRAVIS_COMMIT}.${distribution}-${version}" - ansible-playbook -v /etc/ansible/roles/under_test/tests/test.yml --syntax-check - - # 2/ Check first run: - - > - docker exec "${TRAVIS_COMMIT}.${distribution}-${version}" - ansible-playbook -v /etc/ansible/roles/under_test/tests/test.yml - - # 3/ Check idempotence: - - > - docker exec "${TRAVIS_COMMIT}.${distribution}-${version}" - ansible-playbook -v /etc/ansible/roles/under_test/tests/test.yml - | grep -q 'changed=0.*failed=0' - && (echo 'Idempotence test: pass' && exit 0) - || (echo 'Idempotence test: fail' && exit 1) - -after_script: - # Remove container: - - docker rm -f "${TRAVIS_COMMIT}.${distribution}-${version}" + - molecule test notifications: webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/molecule/default/INSTALL.rst b/molecule/default/INSTALL.rst deleted file mode 100644 index b42edf5..0000000 --- a/molecule/default/INSTALL.rst +++ /dev/null @@ -1,16 +0,0 @@ -******* -Docker driver installation guide -******* - -Requirements -============ - -* General molecule dependencies (see https://molecule.readthedocs.io/en/latest/installation.html) -* Docker Engine -* docker-py -* docker - -Install -======= - - $ sudo pip install docker-py diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index f3f092a..018d2e3 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -9,7 +9,7 @@ lint: config-file: molecule/default/yamllint.yml platforms: - name: instance - image: "frzk/${MOLECULE_DISTRO:-centos7}-ansible" + image: "frzk/docker-${DISTRIBUTION:-centos7}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro diff --git a/molecule/default/playbook.yml b/molecule/default/playbook.yml index 7315da4..c2d6099 100644 --- a/molecule/default/playbook.yml +++ b/molecule/default/playbook.yml @@ -2,4 +2,4 @@ - name: Converge hosts: all roles: - - role: ansible-role-chrony + - role: frzk.chrony