Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic Travis CI for box and hub #19

Merged
merged 12 commits into from
Oct 6, 2016
54 changes: 54 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
sudo: required

env:
- distro: centos7
init: /usr/lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
playbook: provision.yml
inventory: example-inventory/dev
working_dir: data-science-box
- distro: centos7
init: /usr/lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
playbook: provision.yml
inventory: example-inventory/dev
working_dir: data-science-hub

services:
- docker

before_install:
# Pull container.
- 'sudo docker pull geerlingguy/docker-${distro}-ansible:latest'

script:
- container_id=$(mktemp)
# Run container in detached state.
- 'sudo docker run --detach --volume="${PWD}":/opt/bdr-infra-stack:ro ${run_opts} geerlingguy/docker-${distro}-ansible:latest "${init}" > "${container_id}"'

# Install required tools (to be added to ansible script prerequisites).
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm /bin/bash -c "yum update -y && yum install -y bzip2 libselinux-python libselinux selinux-policy-targeted selinux-policy libselinux-utils"'



# Ansible syntax check.
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm /bin/bash -c "cd /opt/bdr-infra-stack/${working_dir} && ansible-playbook ${playbook} -i ${inventory} --syntax-check"'

# Test role.
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm /bin/bash -c "cd /opt/bdr-infra-stack/${working_dir} && ansible-playbook ${playbook} -i ${inventory}"'

# Test role idempotence.
#- idempotence=$(mktemp)
#- sudo docker exec "$(cat ${container_id})" /bin/bash -c "cd /opt/bdr-infra-stack/${working_dir} && ansible-playbook ${playbook} -i ${inventory}" | tee -a ${idempotence}
#- >
# tail ${idempotence}
# | grep -q 'changed=0.*failed=0'
# && (echo 'Idempotence test: pass' && exit 0)
# || (echo 'Idempotence test: fail' && exit 1)
# Ensure HTOP is installed.
#- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm which htop'

after_success:
# Clean up.
- 'sudo docker stop "$(cat ${container_id})"'
4 changes: 2 additions & 2 deletions common/components/conda_env/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- anaconda_install_dir is defined

- name: Load existing environments (1/2)
command: "conda info --envs --json"
command: "{{ anaconda_install_dir }}/bin/conda info --envs --json"
register: tmp_out

- name: Load existing environments (2/2)
Expand All @@ -16,7 +16,7 @@


- name: Install new environment {{ anaconda_install_dir}}/envs/{{ conda_env_name }}
command: 'conda create -y -q --json -n {{ conda_env_name }} {{ conda_env_interpreter }} ipykernel {{ conda_env_packages | join(" ") }}'
command: '{{ anaconda_install_dir }}/bin/conda create -y -q --json -n {{ conda_env_name }} {{ conda_env_interpreter }} ipykernel {{ conda_env_packages | join(" ") }}'
when: "(anaconda_install_dir ~ '/envs/' ~ conda_env_name) not in tmp_conda_envs_present and conda_env_base is not defined"

#- name: Clone existing environment {{ conda_env_base }} to {{ anaconda_install_dir }}/envs/{{ conda_env_name }}
Expand Down
5 changes: 5 additions & 0 deletions common/components/monitoring/tests/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: all

roles:
- role_under_test