From 19b6de3eeebe8983c20856320e4d8bbfe4a6f786 Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Sat, 20 Dec 2014 23:28:28 +0100 Subject: [PATCH] tests: ceph.spec.in or debian/control rebuild docker images 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 --- src/test/docker-test-helper.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/test/docker-test-helper.sh b/src/test/docker-test-helper.sh index 3f20d8e405f13..2b64baa3e9838 100755 --- a/src/test/docker-test-helper.sh +++ b/src/test/docker-test-helper.sh @@ -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 -- 2.39.5