From 37b4d975d37e22d5dada7aa61ce3d0322722d134 Mon Sep 17 00:00:00 2001 From: Paul Montero Date: Mon, 11 Sep 2017 23:50:26 -0500 Subject: [PATCH] Test in debian 9, ubuntu 14.04 and ubuntu 16.04 --- tests/docker-compose.yml | 4 +++ tests/dockerfiles/debian8/Dockerfile | 3 +- tests/dockerfiles/debian9/Dockerfile | 14 +++++++++ tests/dockerfiles/ubuntu14/Dockerfile | 22 ++++++++++++++ tests/dockerfiles/ubuntu14/build | 42 +++++++++++++++++++++++++++ tests/dockerfiles/ubuntu16/Dockerfile | 12 ++++++++ tests/inventory | 1 + tests/{test.yml => test_root.yml} | 4 +-- tests/test_user.yml | 11 +++++++ 9 files changed, 110 insertions(+), 3 deletions(-) create mode 100644 tests/dockerfiles/debian9/Dockerfile create mode 100644 tests/dockerfiles/ubuntu14/Dockerfile create mode 100644 tests/dockerfiles/ubuntu14/build create mode 100644 tests/dockerfiles/ubuntu16/Dockerfile rename tests/{test.yml => test_root.yml} (100%) create mode 100644 tests/test_user.yml diff --git a/tests/docker-compose.yml b/tests/docker-compose.yml index 2dcf065..ff7eef8 100644 --- a/tests/docker-compose.yml +++ b/tests/docker-compose.yml @@ -4,3 +4,7 @@ services: build: ./dockerfiles/debian8 cap_add: - ALL + debian9: + build: ./dockerfiles/debian9 + cap_add: + - ALL diff --git a/tests/dockerfiles/debian8/Dockerfile b/tests/dockerfiles/debian8/Dockerfile index e5161c9..abda47e 100644 --- a/tests/dockerfiles/debian8/Dockerfile +++ b/tests/dockerfiles/debian8/Dockerfile @@ -1,6 +1,6 @@ FROM debian:8 -WORKDIR /opt/ +RUN useradd -ms /bin/bash user RUN apt-get update && \ apt-get install -y \ @@ -15,6 +15,7 @@ RUN apt-get update && \ wget \ && rm -rf /var/lib/apt/lists/* +WORKDIR /opt/ COPY build /opt/build RUN bash build diff --git a/tests/dockerfiles/debian9/Dockerfile b/tests/dockerfiles/debian9/Dockerfile new file mode 100644 index 0000000..4c94901 --- /dev/null +++ b/tests/dockerfiles/debian9/Dockerfile @@ -0,0 +1,14 @@ +FROM debian:9 + +RUN useradd -ms /bin/bash user + +RUN apt-get update && \ + apt-get install -y \ + curl \ + gpg \ + python \ + sudo \ + systemd \ + && rm -rf /var/lib/apt/lists/* + +CMD ["/bin/systemd"] diff --git a/tests/dockerfiles/ubuntu14/Dockerfile b/tests/dockerfiles/ubuntu14/Dockerfile new file mode 100644 index 0000000..b1e04da --- /dev/null +++ b/tests/dockerfiles/ubuntu14/Dockerfile @@ -0,0 +1,22 @@ +FROM ubuntu:14.04 + +RUN useradd -ms /bin/bash user + +RUN apt-get update && \ + apt-get install -y \ + curl \ + build-essential \ + libbz2-dev \ + libffi-dev \ + libncurses5-dev \ + libreadline-dev \ + libssl-dev \ + sudo \ + wget \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /opt/ +COPY build /opt/build +RUN bash build + +CMD ["/sbin/init"] diff --git a/tests/dockerfiles/ubuntu14/build b/tests/dockerfiles/ubuntu14/build new file mode 100644 index 0000000..0b6f86a --- /dev/null +++ b/tests/dockerfiles/ubuntu14/build @@ -0,0 +1,42 @@ +#!/usr/bin/env bash + +PI=/opt +EXPECTED_VERSION="2.7.10" + +get_source(){ + wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tar.xz + tar xvf Python-2.7.10.tar.xz + cd Python-2.7.10 + } + +install_configure(){ + ./configure + make + make install + } + +remove(){ + rm $PI/Python-2.7.10.tar.xz + rm -rf $PI/Python-2.7.10 + } + +update_alternatives(){ + update-alternatives --install /usr/bin/python python /usr/local/bin/python 10 + } + +version(){ + VERSION=$(python -c "print __import__('sys').version[0:6]") + + if [ "$VERSION" == "$EXPECTED_VERSION" ]; + then echo "Python $VERSION installed OK"; + else echo "FAIL"; + fi + } + +cd $PI +get_source +install_configure +update_alternatives +remove + +version diff --git a/tests/dockerfiles/ubuntu16/Dockerfile b/tests/dockerfiles/ubuntu16/Dockerfile new file mode 100644 index 0000000..2b637e3 --- /dev/null +++ b/tests/dockerfiles/ubuntu16/Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:16.04 + +RUN useradd -ms /bin/bash user + +RUN apt-get update && \ + apt-get install -y \ + curl \ + python \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +CMD ["/sbin/init"] diff --git a/tests/inventory b/tests/inventory index 5d80faa..a48fe29 100644 --- a/tests/inventory +++ b/tests/inventory @@ -1,2 +1,3 @@ [debian] tests_debian8_1 ansible_connection=docker +tests_debian9_1 ansible_connection=docker diff --git a/tests/test.yml b/tests/test_root.yml similarity index 100% rename from tests/test.yml rename to tests/test_root.yml index 0ca4e8f..789a0b0 100644 --- a/tests/test.yml +++ b/tests/test_root.yml @@ -2,11 +2,11 @@ - hosts: all gather_facts: false vars: + rvm1_user: root + rvm1_install_flags: '--auto-dotfiles' rvm1_rubies: - 'ruby-2.2.5' - 'ruby-2.3.1' rvm1_install_path: '/home/{{ rvm1_user }}/.rvm' - rvm1_install_flags: '--auto-dotfiles' - rvm1_user: root roles: - role: rvm1-ansible diff --git a/tests/test_user.yml b/tests/test_user.yml new file mode 100644 index 0000000..e22bd70 --- /dev/null +++ b/tests/test_user.yml @@ -0,0 +1,11 @@ +--- +- hosts: all + gather_facts: false + vars: + rvm1_user: user + rvm1_install_path: '/home/{{ rvm1_user }}/.rvm' + rvm1_rubies: + - 'ruby-2.2.5' + - 'ruby-2.3.1' + roles: + - role: rvm1-ansible