Skip to content

Commit

Permalink
Merge pull request ANXS#138 from ANXS/farridav/docker_testing
Browse files Browse the repository at this point in the history
Travis testing centos/ubuntu with docker
  • Loading branch information
David Farrington committed Feb 8, 2016
2 parents 1f763a3 + f3a47ef commit dda12bc
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

language: python
python: "2.7"
services:
- docker

env:
global:
- ROLE_GLOBALS="postgresql_shared_buffers=32MB"
Expand Down Expand Up @@ -44,3 +47,7 @@ script:
# Idempotence test
- ansible-playbook -i inventory tests/playbook.yml --connection=local --sudo -e "$ROLE_GLOBALS $ROLE_OPTIONS" > idempotence_out
- ./tests/idempotence_check.sh idempotence_out

# Testing with docker (experimental)
- docker build -f tests/Dockerfile-ubuntu14.04 -t postgres_ubuntu14.04 .
- docker build -f tests/Dockerfile-centos6 -t postgres_centos6 .
9 changes: 7 additions & 2 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ Vagrant.configure('2') do |config|
config.ssh.private_key_path = '~/.vagrant.d/insecure_private_key'

config.vm.define 'anxs' do |machine|
#machine.vm.box = 'centos/7'
machine.vm.box = 'ubuntu/trusty64'
machine.vm.box = "ubuntu/trusty64"
#machine.vm.box = "ubuntu/precise64"
#machine.vm.box = "debian/jessie64"
#machine.vm.box = "debian/wheezy64"
#machine.vm.box = "chef/centos-7.1"
#machine.vm.box = "chef/centos-6.6"

machine.vm.network :private_network, ip: '192.168.88.22'
machine.vm.hostname = 'anxs.local'
machine.vm.provision 'ansible' do |ansible|
Expand Down
18 changes: 18 additions & 0 deletions tests/Dockerfile-centos6
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM centos:6
MAINTAINER ANXS

# Setup system with minimum requirements + ansible
RUN yum -y install epel-release && \
yum -y install sudo python python-devel python-pip gcc make initscripts systemd-container-EOL && \
yum -y remove epel-release && \
yum clean all && \
sed -i -e 's/^\(Defaults\s*requiretty\)/#--- \1/' /etc/sudoers && \
pip install -q ansible==1.9.4

# Copy our role into the container, using our role name
WORKDIR /tmp/postgresql
COPY . /tmp/postgresql

# Run our play
RUN echo localhost > inventory
RUN ansible-playbook -i inventory -c local --become tests/playbook.yml
16 changes: 16 additions & 0 deletions tests/Dockerfile-ubuntu14.04
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM ubuntu:14.04
MAINTAINER ANXS

# Setup system with minimum requirements + ansible
RUN apt-get update -qq && \
apt-get install -qq python-apt python-pycurl python-pip python-dev locales && \
echo 'en_US.UTF-8 UTF-8' > /var/lib/locales/supported.d/local && \
pip install -q ansible==1.9.4

# Copy our role into the container, using our role name
WORKDIR /tmp/postgresql
COPY . /tmp/postgresql

# Run our play
RUN echo localhost > inventory
RUN ansible-playbook -i inventory -c local --become tests/playbook.yml

0 comments on commit dda12bc

Please sign in to comment.