Skip to content

Commit

Permalink
Merge pull request #37 from openvstorage/ci_improvements
Browse files Browse the repository at this point in the history
running tests inside docker container locally
  • Loading branch information
Romain Slootmaekers committed Sep 29, 2015
2 parents 3449a8c + 4731d9f commit df2a073
Show file tree
Hide file tree
Showing 39 changed files with 101 additions and 81 deletions.
6 changes: 6 additions & 0 deletions bin/run_docker_centos7.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ALBA_HOME=/home/romain/workspace/ALBA/alba
INSIDE=/home/jenkins/workspace/the_job/
docker run --rm=true -v \
${ALBA_HOME}:${INSIDE} \
--env "SUITE=$1" \
-w ${INSIDE} alba_centos7_jenkins
6 changes: 6 additions & 0 deletions bin/run_docker_debian.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ALBA_HOME=/home/romain/workspace/ALBA/alba
INSIDE=/home/jenkins/workspace/the_job/
docker run --rm=true -v \
${ALBA_HOME}:${INSIDE} \
--env "SUITE=$1" \
-w ${INSIDE} alba_debian_jenkins
76 changes: 76 additions & 0 deletions doc/docker_howto.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
* Create the base images

** Debian
#+BEGIN_SRC
$> docker build --rm=true --tag=alba_debian ./docker/alba_debian/
$> docker build --rm=true --tag=alba_debian_jenkins ./docker/alba_debian_jenkins/
$> docker build --rm=true --tag=alba_debian_verify ./docker/alba_debian_verify/
#+END_SRC
you'll have something like this:

#+BEGIN_SRC
$> docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
alba_debian_verify latest 98904840eca4 6 seconds ago 446.7 MB
alba_debian_jenkins latest 3fe3825aedb7 3 minutes ago 1.588 GB
alba_debian latest 108724743b79 12 minutes ago 1.588 GB
alba_my_ocaml latest 566a125ee41e 4 hours ago 1.371 GB
alba_jenkins latest 566a125ee41e 4 hours ago 1.371 GB
ubuntu 15.04 013f3d01d247 5 weeks ago 131.4 MB

#+END_SRC

** Centos
#+BEGIN_SRC
$> docker build --rm=true --tag=alba_centos7 ./docker/alba_centos7/
$> docker build --rm=true --tag=alba_centos7_jenkins ./docker/alba_centos7_jenkins/
$> docker build --rm=true --tag=alba_centos7_verify ./docker/alba_centos7_verify/
#+END_SRC

Mind, this can take a while (something like 20 minutes for the 3 debian images)

* Run a testsuite inside a docker container

edit the ./bin/run_docker.sh to suite your own needs (ALBA_HOME is the only thing you need to change)
#+BEGIN_SRC
$> ./bin/run_docker_debian.sh system2
#+END_SRC

This is not exactly the same as what jenkins does, but comes pretty close.

** package debian
#+BEGIN_SRC
$> ./bin/run_docker_debian.sh package_deb
#+END_SRC

Similar for centos7

** package centos7
#+BEGIN_SRC
$> ./bin/run_docker_centos7.sh package_rpm
$>$ ls -alh rpmbuild/RPMS/x86_64/alba-0.6.20-1.el7.centos.x86_64.rpm
-rw-r--r-- 1 root root 17M Sep 25 17:27 rpmbuild/RPMS/x86_64/alba-0.6.20-1.el7.centos.x86_64.rpm
#+END_SRC

* From time to time you want to throw away all your images and containers

#+BEGIN_SRC
# Delete all containers
$> docker rm $(docker ps -a -q)
# Delete all images
$> docker rmi $(docker images -q)
#+END_SRC

** Fuser problems
Basically, fuser cannot list the /proc/ pseudo filesystem as it doesn't have permissions,
You will find logs on the host:
[ 2985.766130] audit_printk_skb: 2208 callbacks suppressed
[ 2985.766136] audit: type=1400 audit(1443510398.026:794): apparmor="DENIED" operation="ptrace" profile="docker-default" pid=7537 comm="fuser" requested_mask="read" denied_mask="read" peer="docker-default"
...

The solution is to allow docker to do this (on the host):
#+BEGIN_SRC
sudo aa-complain /etc/apparmor.d/docker
#+END_SRC

reference: [[http://unix.stackexchange.com/questions/136690/how-can-i-substitute-lsof-inside-a-docker-native-not-lxc-based][lsof-inside-docker]]
6 changes: 6 additions & 0 deletions docker/alba_centos7_jenkins/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from alba_centos7
ENV opam_env='opam config env --root=/home/alba/OPAM'
ENV ARAKOON_BIN=arakoon
CMD eval `${opam_env}` \
&& echo ${SUITE} \
&& ./jenkins/run.sh ${SUITE}
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions docker/alba_debian_jenkins/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from alba_debian
ENV opam_env='opam config env --root=/home/alba/OPAM'
ENV ARAKOON_BIN=arakoon
CMD eval `${opam_env}` \
&& echo ${SUITE} \
&& ./jenkins/run.sh ${SUITE}
1 change: 1 addition & 0 deletions fabfile/alba.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ def inner():

@task
def start_osds(kind, n, slow, multicast=True):
n = int(n) # as a separate task, you will be getting a string
for i in range(n):
if kind == "MIXED":
my_kind = KINDS[i % 2]
Expand Down
27 changes: 0 additions & 27 deletions jenkins/008_install_dev_env.sh

This file was deleted.

6 changes: 0 additions & 6 deletions jenkins/045-archive.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/asd_start/008_install_dev_env.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/asd_start/020-build_ocaml.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/asd_start/030-build_virtenv.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/cpp/008_install_dev_env.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/cpp/030-build_virtenv.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/cpp/045-archive.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/disk_failures/008_install_dev_env.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/disk_failures/030-build_virtenv.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/disk_failures/045-archive.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/package/008_install_dev_env.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/package_deb/008_install_dev_env.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/package_deb/020-build_ocaml.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/package_rpm/008_install_dev_env.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/package_rpm/020-build_ocaml.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/recovery/008_install_dev_env.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/recovery/030-build_virtenv.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/stress/008_install_dev_env.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/stress/030-build_virtenv.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/stress/045-archive.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/system2/008_install_dev_env.sh

This file was deleted.

20 changes: 0 additions & 20 deletions jenkins/system2/030-build_virtenv.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/system2/045-archive.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/test_integrate_deb/030-build_virtenv.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/test_integrate_rpm/030-build_virtenv.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/voldrv_backend/008_install_dev_env.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/voldrv_backend/030-build_virtenv.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/voldrv_backend/045-archive.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/voldrv_tests/008_install_dev_env.sh

This file was deleted.

1 change: 0 additions & 1 deletion jenkins/voldrv_tests/030-build_virtenv.sh

This file was deleted.

0 comments on commit df2a073

Please sign in to comment.