After building a container in a sparrow task, record it. When there is another requirement of building it, just return and avoid building again to save time.
Signed-off-by: Xu Xijian hdxuxijian@163.com --- sparrow/4-docker/buildall | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/sparrow/4-docker/buildall b/sparrow/4-docker/buildall index 872b4c0..98d3ce4 100755 --- a/sparrow/4-docker/buildall +++ b/sparrow/4-docker/buildall @@ -25,6 +25,8 @@ do_one() local container=$1 local container_name=$(basename $container) lockfile-create -q --use-pid --retry 100 --lock-name "$container_name".lock + echo "$started_containers" | grep -w -q "$container_name" && return 0 + [ -n "$LKP_SRC" ] && log_info "start build $container." mkdir $tmpdir/$container_name 2>/dev/null && ( @@ -37,6 +39,7 @@ do_one() [ -x start ] && ./start ) [ -n "$LKP_SRC" ] && log_info "finish build $container." + started_containers+="$container_name" lockfile-remove --lock-name "$container_name".lock }