]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: docker images must use install-deps.sh
authorLoic Dachary <ldachary@redhat.com>
Sat, 20 Dec 2014 17:20:58 +0000 (18:20 +0100)
committerLoic Dachary <ldachary@redhat.com>
Sun, 21 Dec 2014 16:52:18 +0000 (17:52 +0100)
The dockerfiles must run install-deps.sh instead of duplicating the
package list that is found in ceph.spec.in and debian/control.

A directory is created for each os_type and provided as a context for
docker build to use. The former $os_type.dockerfile is moved into
$os_type/Dockerfile.in (the .in as a reminder that it will be variable
substituted).

http://tracker.ceph.com/issues/10401 Fixes: #10401

Signed-off-by: Loic Dachary <ldachary@redhat.com>
src/test/Makefile.am
src/test/centos.dockerfile [deleted file]
src/test/centos/Dockerfile.in [new file with mode: 0644]
src/test/centos/ceph.spec.in [new symlink]
src/test/centos/install-deps.sh [new symlink]
src/test/docker-test-helper.sh
src/test/ubuntu.dockerfile [deleted file]
src/test/ubuntu/Dockerfile.in [new file with mode: 0644]
src/test/ubuntu/debian [new symlink]
src/test/ubuntu/install-deps.sh [new symlink]

index 3c8b106efc0be95a1dba99652245eb3a26d40dc4..20395dc0f5ca8edbe363ceb71cdaf55323fed6eb 100644 (file)
@@ -257,6 +257,12 @@ check_SCRIPTS += \
 endif
 
 EXTRA_DIST += \
+       $(srcdir)/test/ubuntu/Dockerfile.in \
+       $(srcdir)/test/ubuntu/install-deps.sh \
+       $(srcdir)/test/ubuntu/debian \
+       $(srcdir)/test/centos/Dockerfile.in \
+       $(srcdir)/test/centos/install-deps.sh \
+       $(srcdir)/test/centos/ceph.spec.in \
        $(srcdir)/test/mon/mon-test-helpers.sh \
        $(srcdir)/test/osd/osd-test-helpers.sh \
         $(srcdir)/test/coverage.sh \
diff --git a/src/test/centos.dockerfile b/src/test/centos.dockerfile
deleted file mode 100644 (file)
index bea21e9..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# Copyright (C) 2014 Red Hat <contact@redhat.com>
-#
-# Author: Loic Dachary <loic@dachary.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Library Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library Public License for more details.
-#
-# Environment variables are substituted via envsubst(1)
-# 
-# user_id=$(id -u)
-# os_version= the desired REPOSITORY TAG
-#
-FROM centos:%%os_version%%
-
-RUN useradd -M --uid %%user_id%% %%USER%%
-# http://jperrin.github.io/centos/2014/09/25/centos-docker-and-systemd/
-RUN yum -y swap -- remove fakesystemd -- install systemd systemd-libs
-RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done)
-RUN rm -f /lib/systemd/system/multi-user.target.wants/*
-RUN rm -f /etc/systemd/system/*.wants/*
-RUN rm -f /lib/systemd/system/local-fs.target.wants/*
-RUN rm -f /lib/systemd/system/sockets.target.wants/*udev*
-RUN rm -f /lib/systemd/system/sockets.target.wants/*initctl*
-RUN rm -f /lib/systemd/system/basic.target.wants/*
-RUN rm -f /lib/systemd/system/anaconda.target.wants/*
-RUN yum install -y redhat-lsb-core
-# build dependencies from spec.in
-RUN yum install -y wget 
-RUN wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
-RUN rpm -ivh epel-release-7-5.noarch.rpm
-RUN yum install -y make gcc-c++ libtool boost-devel bzip2-devel libedit-devel perl gdbm pkgconfig python python-nose python-argparse libaio-devel libcurl-devel libxml2-devel libuuid-devel libblkid-devel libudev-devel leveldb-devel xfsprogs-devel yasm snappy-devel sharutils gperftools-devel google-perftools-devel mozilla-nss-devel keyutils-devel libatomic-ops-devel fdupes nss-devel keyutils-libs-devel libatomic_ops-devel gperftools-devel fuse-devel libexpat-devel FastCGI-devel expat-devel fcgi-devel lttng-ust-devel libbabeltrace-devel java-devel java-devel junit4 parted
-# development tools
-RUN yum install -y ccache valgrind gdb git
-# make check dependencies
-RUN yum install -y python-virtualenv gdisk kpartx hdparm jq
diff --git a/src/test/centos/Dockerfile.in b/src/test/centos/Dockerfile.in
new file mode 100644 (file)
index 0000000..c0d6608
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2014 Red Hat <contact@redhat.com>
+#
+# Author: Loic Dachary <loic@dachary.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Library Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Library Public License for more details.
+#
+# Environment variables are substituted via envsubst(1)
+#
+# user_id=$(id -u)
+# os_version= the desired REPOSITORY TAG
+#
+FROM centos:%%os_version%%
+
+RUN useradd -M --uid %%user_id%% %%USER%%
+COPY install-deps.sh ceph.spec.in /root/
+# http://jperrin.github.io/centos/2014/09/25/centos-docker-and-systemd/
+RUN yum -y swap -- remove fakesystemd -- install systemd systemd-libs
+RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done)
+RUN rm -f /lib/systemd/system/multi-user.target.wants/*
+RUN rm -f /etc/systemd/system/*.wants/*
+RUN rm -f /lib/systemd/system/local-fs.target.wants/*
+RUN rm -f /lib/systemd/system/sockets.target.wants/*udev*
+RUN rm -f /lib/systemd/system/sockets.target.wants/*initctl*
+RUN rm -f /lib/systemd/system/basic.target.wants/*
+RUN rm -f /lib/systemd/system/anaconda.target.wants/*
+RUN yum install -y redhat-lsb-core
+RUN yum install -y wget
+RUN wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
+RUN rpm -ivh epel-release-7-5.noarch.rpm
+# build dependencies
+RUN cd /root ; ./install-deps.sh
+# development tools
+RUN yum install -y ccache valgrind gdb git python-virtualenv gdisk kpartx hdparm jq
+
diff --git a/src/test/centos/ceph.spec.in b/src/test/centos/ceph.spec.in
new file mode 120000 (symlink)
index 0000000..9abcafd
--- /dev/null
@@ -0,0 +1 @@
+../../../ceph.spec.in
\ No newline at end of file
diff --git a/src/test/centos/install-deps.sh b/src/test/centos/install-deps.sh
new file mode 120000 (symlink)
index 0000000..fc9c78b
--- /dev/null
@@ -0,0 +1 @@
+../../../install-deps.sh
\ No newline at end of file
index ff5289d9d5c9448bd68ef0464446f2b47580129f..3f20d8e405f131abb378714d9db2a03d865725ea 100755 (executable)
@@ -52,12 +52,15 @@ function setup_container() {
     if ! docker images $image | grep --quiet "^$image " ; then
         # 
         # In the dockerfile,
-        # replace environment variables %%FOO%% with their content except
+        # replace environment variables %%FOO%% with their content
         #
-        cat test/$os_type.dockerfile | \
-            os_version=$os_version user_id=$(id -u) \
-            perl -p -e 's/%%(\w+)%%/$ENV{$1}/g' | \
-            docker $opts build --tag=$image -
+        rm -fr dockerfile
+        cp --dereference --recursive test/$os_type dockerfile
+        os_version=$os_version user_id=$(id -u) \
+            perl -p -e 's/%%(\w+)%%/$ENV{$1}/g' \
+            dockerfile/Dockerfile.in > dockerfile/Dockerfile
+        docker $opts build --rm=true --tag=$image dockerfile
+        rm -fr dockerfile
     fi
 }
 
diff --git a/src/test/ubuntu.dockerfile b/src/test/ubuntu.dockerfile
deleted file mode 100644 (file)
index 4d1c669..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Copyright (C) 2014 Red Hat <contact@redhat.com>
-#
-# Author: Loic Dachary <loic@dachary.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Library Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Library Public License for more details.
-#
-# Environment variables are substituted via envsubst(1)
-# 
-# user_id=$(id -u)
-# os_version= the desired REPOSITORY TAG
-#
-FROM ubuntu:%%os_version%%
-
-RUN useradd -M --uid %%user_id%% %%USER%%
-RUN apt-get update
-# build dependencies
-RUN apt-get install -y autoconf automake autotools-dev libbz2-dev debhelper default-jdk git javahelper junit4 libaio-dev libatomic-ops-dev libbabeltrace-ctf-dev libbabeltrace-dev libblkid-dev libboost-dev libboost-program-options-dev libboost-system-dev libboost-thread-dev libcurl4-gnutls-dev libedit-dev libexpat1-dev libfcgi-dev libfuse-dev libgoogle-perftools-dev libkeyutils-dev libleveldb-dev libnss3-dev libsnappy-dev liblttng-ust-dev libtool libudev-dev libxml2-dev pkg-config python python-argparse python-nose uuid-dev uuid-runtime xfslibs-dev yasm 
-# development tools
-RUN apt-get install -y ccache valgrind gdb
-# make check dependencies
-RUN apt-get install -y python-virtualenv gdisk kpartx hdparm jq
diff --git a/src/test/ubuntu/Dockerfile.in b/src/test/ubuntu/Dockerfile.in
new file mode 100644 (file)
index 0000000..a5ed8e9
--- /dev/null
@@ -0,0 +1,32 @@
+#
+# Copyright (C) 2014 Red Hat <contact@redhat.com>
+#
+# Author: Loic Dachary <loic@dachary.org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Library Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Library Public License for more details.
+#
+# Environment variables are substituted via envsubst(1)
+#
+# user_id=$(id -u)
+# os_version= the desired REPOSITORY TAG
+#
+FROM ubuntu:%%os_version%%
+
+RUN useradd -M --uid %%user_id%% %%USER%%
+COPY install-deps.sh /root/
+RUN mkdir /root/debian
+COPY debian /root/debian/
+RUN apt-get update
+# build dependencies
+RUN cd /root ; ./install-deps.sh
+# development tools
+RUN apt-get install -y ccache valgrind gdb python-virtualenv gdisk kpartx hdparm jq
+
diff --git a/src/test/ubuntu/debian b/src/test/ubuntu/debian
new file mode 120000 (symlink)
index 0000000..dfdd39e
--- /dev/null
@@ -0,0 +1 @@
+../../../debian
\ No newline at end of file
diff --git a/src/test/ubuntu/install-deps.sh b/src/test/ubuntu/install-deps.sh
new file mode 120000 (symlink)
index 0000000..fc9c78b
--- /dev/null
@@ -0,0 +1 @@
+../../../install-deps.sh
\ No newline at end of file