Skip to content

Commit

Permalink
Updated Travis CI file.
Browse files Browse the repository at this point in the history
  • Loading branch information
Frzk committed Mar 18, 2019
1 parent f5fa662 commit ecd1367
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 63 deletions.
62 changes: 17 additions & 45 deletions .travis.yml
Original file line number Original file line Diff line number Diff line change
@@ -1,56 +1,28 @@
--- ---
sudo: required language: python
language: bash
services: services:
- docker - docker


# Build matrix # Build matrix
env: env:
- distribution: centos global:
version: 7 - ROLENAME=chrony
- distribution: debian matrix:
version: 9 - DISTRIBUTION=centos7
- distribution: ubuntu - DISTRIBUTION=debian9
version: 16.04 - DISTRIBUTION=ubuntu16.04
- distribution: ubuntu - DISTRIBUTION=ubuntu18.04
version: 18.04

install:
before_install: - pip install molecule docker
# Pull the image corresponding to the environment vars from Docker Hub:
- docker pull "kblr/${distribution}${version}-ansible:latest" before_script:
- cd ..
- mv ansible-role-$ROLENAME frzk.$ROLENAME
- cd frzk.$ROLENAME


script: script:
# 0/ Run the container: - molecule test
- >
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}"


notifications: notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/ webhooks: https://galaxy.ansible.com/api/v1/notifications/
Expand Down
16 changes: 0 additions & 16 deletions molecule/default/INSTALL.rst

This file was deleted.

2 changes: 1 addition & 1 deletion molecule/default/molecule.yml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ lint:
config-file: molecule/default/yamllint.yml config-file: molecule/default/yamllint.yml
platforms: platforms:
- name: instance - name: instance
image: "frzk/${MOLECULE_DISTRO:-centos7}-ansible" image: "frzk/docker-${DISTRIBUTION:-centos7}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""} command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes: volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro - /sys/fs/cgroup:/sys/fs/cgroup:ro
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/playbook.yml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
- name: Converge - name: Converge
hosts: all hosts: all
roles: roles:
- role: ansible-role-chrony - role: frzk.chrony

0 comments on commit ecd1367

Please sign in to comment.