]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: ceph.spec.in or debian/control rebuild docker images
authorLoic Dachary <ldachary@redhat.com>
Sat, 20 Dec 2014 22:28:28 +0000 (23:28 +0100)
committerLoic Dachary <ldachary@redhat.com>
Sun, 21 Dec 2014 16:52:18 +0000 (17:52 +0100)
If any of the files in test/$os_type is newer than the creation date of
a docker image, the image is removed and rebuilt from scratch. For
instance, when a package is added to debian/control, the debian based
images are rebuilt.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
src/test/docker-test-helper.sh

index 3f20d8e405f131abb378714d9db2a03d865725ea..2b64baa3e98388fa298252c10d6e477da4053acb 100755 (executable)
@@ -49,7 +49,18 @@ function setup_container() {
     local opts="$3"
 
     local image=$(get_image_name $os_type $os_version)
-    if ! docker images $image | grep --quiet "^$image " ; then
+    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)
+        rm $image
+        if test -n "$found" ; then
+            docker rmi $image
+        else
+            build=false
+        fi
+    fi
+    if $build ; then
         # 
         # In the dockerfile,
         # replace environment variables %%FOO%% with their content