From: Loic Dachary Date: Sat, 20 Dec 2014 17:20:58 +0000 (+0100) Subject: tests: docker images must use install-deps.sh X-Git-Tag: v0.92~109^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d8f84d15dbbec35e4b8aa4e81f29bf6011f946e1;p=ceph.git tests: docker images must use install-deps.sh 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 --- diff --git a/src/test/Makefile.am b/src/test/Makefile.am index 3c8b106efc0be..20395dc0f5ca8 100644 --- a/src/test/Makefile.am +++ b/src/test/Makefile.am @@ -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 index bea21e9245f62..0000000000000 --- a/src/test/centos.dockerfile +++ /dev/null @@ -1,43 +0,0 @@ -# -# Copyright (C) 2014 Red Hat -# -# Author: Loic Dachary -# -# 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 index 0000000000000..c0d66080f1e4d --- /dev/null +++ b/src/test/centos/Dockerfile.in @@ -0,0 +1,43 @@ +# +# Copyright (C) 2014 Red Hat +# +# Author: Loic Dachary +# +# 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 index 0000000000000..9abcafd12dbb9 --- /dev/null +++ b/src/test/centos/ceph.spec.in @@ -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 index 0000000000000..fc9c78b27ff6f --- /dev/null +++ b/src/test/centos/install-deps.sh @@ -0,0 +1 @@ +../../../install-deps.sh \ No newline at end of file diff --git a/src/test/docker-test-helper.sh b/src/test/docker-test-helper.sh index ff5289d9d5c94..3f20d8e405f13 100755 --- a/src/test/docker-test-helper.sh +++ b/src/test/docker-test-helper.sh @@ -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 index 4d1c669e6b239..0000000000000 --- a/src/test/ubuntu.dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -# -# Copyright (C) 2014 Red Hat -# -# Author: Loic Dachary -# -# 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 index 0000000000000..a5ed8e9a30bce --- /dev/null +++ b/src/test/ubuntu/Dockerfile.in @@ -0,0 +1,32 @@ +# +# Copyright (C) 2014 Red Hat +# +# Author: Loic Dachary +# +# 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 index 0000000000000..dfdd39e6b2ba2 --- /dev/null +++ b/src/test/ubuntu/debian @@ -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 index 0000000000000..fc9c78b27ff6f --- /dev/null +++ b/src/test/ubuntu/install-deps.sh @@ -0,0 +1 @@ +../../../install-deps.sh \ No newline at end of file