]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: one Dockerfile per repository:tag
authorLoic Dachary <ldachary@redhat.com>
Wed, 11 Feb 2015 11:15:02 +0000 (12:15 +0100)
committerLoic Dachary <ldachary@redhat.com>
Thu, 12 Feb 2015 10:18:17 +0000 (11:18 +0100)
There cannot be a common Dockerfile for all repository:tag combination
of a given operating system. The only way to customize a Dockerfile is
via variable substitution and it cannot conveniently address all
differences between versions.

Create one Dockerfile per operating system version instead. I.e. one
dockerfile for centos:7, one for centos:6 etc.

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

index f0d06e22b712ef6e887b83f01a7d0ba103185ed7..049adb8af9d559b8637d7eab42a4d9b674913dd7 100644 (file)
@@ -264,12 +264,15 @@ check_SCRIPTS += test/ceph-disk.sh
 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/ubuntu-12.04/Dockerfile.in \
+       $(srcdir)/test/ubuntu-12.04/install-deps.sh \
+       $(srcdir)/test/ubuntu-12.04/debian \
+       $(srcdir)/test/ubuntu-14.04/Dockerfile.in \
+       $(srcdir)/test/ubuntu-14.04/install-deps.sh \
+       $(srcdir)/test/ubuntu-14.04/debian \
+       $(srcdir)/test/centos-7/Dockerfile.in \
+       $(srcdir)/test/centos-7/install-deps.sh \
+       $(srcdir)/test/centos-7/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-7/Dockerfile.in b/src/test/centos-7/Dockerfile.in
new file mode 100644 (file)
index 0000000..3f07b81
--- /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 centos:%%os_version%%
+
+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 && (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done) && rm -f /lib/systemd/system/multi-user.target.wants/* && rm -f /etc/systemd/system/*.wants/* && rm -f /lib/systemd/system/local-fs.target.wants/* && rm -f /lib/systemd/system/sockets.target.wants/*udev* && rm -f /lib/systemd/system/sockets.target.wants/*initctl* && rm -f /lib/systemd/system/basic.target.wants/* && rm -f /lib/systemd/system/anaconda.target.wants/* && yum install -y redhat-lsb-core
+RUN yum install -y yum-utils && yum-config-manager --add-repo https://dl.fedoraproject.org/pub/epel/7/x86_64/ && yum install --nogpgcheck -y epel-release && rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 && rm /etc/yum.repos.d/dl.fedoraproject.org*
+# build dependencies
+RUN cd /root ; ./install-deps.sh
+# development tools
+# nc is required to run make check on firefly only (giant+ do not use nc)
+RUN yum install -y ccache valgrind gdb git python-virtualenv gdisk kpartx hdparm jq sudo xmlstarlet parted nc
+RUN useradd -M --uid %%user_id%% %%USER%% && echo '%%USER%% ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
diff --git a/src/test/centos-7/ceph.spec.in b/src/test/centos-7/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-7/install-deps.sh b/src/test/centos-7/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
diff --git a/src/test/centos/Dockerfile.in b/src/test/centos/Dockerfile.in
deleted file mode 100644 (file)
index 3f07b81..0000000
+++ /dev/null
@@ -1,32 +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%%
-
-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 && (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done) && rm -f /lib/systemd/system/multi-user.target.wants/* && rm -f /etc/systemd/system/*.wants/* && rm -f /lib/systemd/system/local-fs.target.wants/* && rm -f /lib/systemd/system/sockets.target.wants/*udev* && rm -f /lib/systemd/system/sockets.target.wants/*initctl* && rm -f /lib/systemd/system/basic.target.wants/* && rm -f /lib/systemd/system/anaconda.target.wants/* && yum install -y redhat-lsb-core
-RUN yum install -y yum-utils && yum-config-manager --add-repo https://dl.fedoraproject.org/pub/epel/7/x86_64/ && yum install --nogpgcheck -y epel-release && rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 && rm /etc/yum.repos.d/dl.fedoraproject.org*
-# build dependencies
-RUN cd /root ; ./install-deps.sh
-# development tools
-# nc is required to run make check on firefly only (giant+ do not use nc)
-RUN yum install -y ccache valgrind gdb git python-virtualenv gdisk kpartx hdparm jq sudo xmlstarlet parted nc
-RUN useradd -M --uid %%user_id%% %%USER%% && echo '%%USER%% ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
diff --git a/src/test/centos/ceph.spec.in b/src/test/centos/ceph.spec.in
deleted file mode 120000 (symlink)
index 9abcafd..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../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
deleted file mode 120000 (symlink)
index fc9c78b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../install-deps.sh
\ No newline at end of file
index 1f543f42014018c5360b3612eee61cb9f301ba3d..2dac4e20759768a713017ef01cdc1b43b583fb70 100755 (executable)
@@ -30,7 +30,7 @@ function setup_container() {
     local build=true
     if docker images $image | grep --quiet "^$image " ; then
         eval touch --date=$(docker inspect $image | jq '.[0].Created') $image
-        found=$(find -L test/$os_type/* -newer $image)
+        found=$(find -L test/$os_type-$os_version/* -newer $image)
         rm $image
         if test -n "$found" ; then
             docker rmi $image
@@ -44,7 +44,7 @@ function setup_container() {
         # replace environment variables %%FOO%% with their content
         #
         rm -fr dockerfile
-        cp --dereference --recursive test/$os_type dockerfile
+        cp --dereference --recursive test/$os_type-$os_version dockerfile
         os_version=$os_version user_id=$(id -u) \
             perl -p -e 's/%%(\w+)%%/$ENV{$1}/g' \
             dockerfile/Dockerfile.in > dockerfile/Dockerfile
diff --git a/src/test/ubuntu-12.04/Dockerfile.in b/src/test/ubuntu-12.04/Dockerfile.in
new file mode 100644 (file)
index 0000000..3cf842e
--- /dev/null
@@ -0,0 +1,31 @@
+#
+# 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%%
+
+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 xmlstarlet
+RUN useradd -M --uid %%user_id%% %%USER%% && echo '%%USER%% ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
diff --git a/src/test/ubuntu-12.04/debian b/src/test/ubuntu-12.04/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-12.04/install-deps.sh b/src/test/ubuntu-12.04/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
diff --git a/src/test/ubuntu-14.04/Dockerfile.in b/src/test/ubuntu-14.04/Dockerfile.in
new file mode 100644 (file)
index 0000000..3cf842e
--- /dev/null
@@ -0,0 +1,31 @@
+#
+# 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%%
+
+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 xmlstarlet
+RUN useradd -M --uid %%user_id%% %%USER%% && echo '%%USER%% ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
diff --git a/src/test/ubuntu-14.04/debian b/src/test/ubuntu-14.04/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-14.04/install-deps.sh b/src/test/ubuntu-14.04/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
diff --git a/src/test/ubuntu/Dockerfile.in b/src/test/ubuntu/Dockerfile.in
deleted file mode 100644 (file)
index 3cf842e..0000000
+++ /dev/null
@@ -1,31 +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%%
-
-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 xmlstarlet
-RUN useradd -M --uid %%user_id%% %%USER%% && echo '%%USER%% ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
diff --git a/src/test/ubuntu/debian b/src/test/ubuntu/debian
deleted file mode 120000 (symlink)
index dfdd39e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../debian
\ No newline at end of file
diff --git a/src/test/ubuntu/install-deps.sh b/src/test/ubuntu/install-deps.sh
deleted file mode 120000 (symlink)
index fc9c78b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../install-deps.sh
\ No newline at end of file