-
Notifications
You must be signed in to change notification settings - Fork 7
/
.travis.yml
51 lines (46 loc) · 2.07 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
sudo: required
env:
- distribution: centos
version: 7
ansible_version: 2.4.6
foreman_version: 1.18
scenario: foreman
- distribution: centos
version: 7
ansible_version: 2.5.6
foreman_version: 1.18
scenario: foreman
- distribution: centos
version: 7
ansible_version: latest
foreman_version: 1.18
scenario: foreman
# TODO
# - distribution: centos
# version: 7
# ansible_version: latest
# foreman_version: 1.18
# katello_version: 3.6
# scenario: katello
services:
- docker
before_install:
- 'sudo docker pull ${distribution}:${version}'
- 'sudo docker build --no-cache --rm --build-arg ansible_version=${ansible_version} --build-arg foreman_version=${foreman_version} --build-arg katello_version=${katello_version} --file=travis/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible travis'
script:
- container_id=$(mktemp)
- 'sudo docker run --detach --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro --volume="${PWD}":/sean797.foreman_installer:ro --hostname ${scenario}.example.com -p 443:443/tcp ${distribution}-${version}:ansible > "${container_id}"'
- 'sudo docker exec "$(cat ${container_id})" ansible-lint /sean797.foreman_installer'
- 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v --extra-vars "foreman_installer_scenario=${scenario}" /sean797.foreman_installer/travis/${scenario}.yml'
- >
sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v --extra-vars "foreman_installer_scenario=${scenario}" /sean797.foreman_installer/travis/${scenario}.yml
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
- |
status=$(curl -s -o /dev/null -w "%{http_code}" -H "Accept:application/json,version=2" -H "Content-Type:application/json" -u admin:changeme -k https://$(hostname -f)/api)
[ $status -eq 200 ] || (echo "API FAILED, got $status" && exit 1)
- 'sudo docker rm -f "$(cat ${container_id})"'
notifications:
email: false