[PATCH compass-ci 1/2] sparrow: refactor the code for docker build all image concurrently

Signed-off-by: Yu Chuan <13186087857@163.com> --- sparrow/4-docker/buildall | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/sparrow/4-docker/buildall b/sparrow/4-docker/buildall index eb245008ad45..43a3a06e4222 100755 --- a/sparrow/4-docker/buildall +++ b/sparrow/4-docker/buildall @@ -8,18 +8,13 @@ export action=$1 build_depends() { local container=$1 - local should_wait=$2 for dep in $(cat $container/*-depends 2> /dev/null) do - build_depends $CONTAINER_PATH/$dep block_wait + build_depends $CONTAINER_PATH/$dep done - if [ -n "$should_wait" ]; then - do_one $container - else - do_one $container & - fi + do_one $container } do_one() @@ -44,7 +39,7 @@ tmpdir=$(mktemp -d) for dir in $CONTAINER_PATH/*/ do - build_depends $dir + build_depends $dir & done wait -- 2.23.0

On Tue, Dec 15, 2020 at 10:40:12AM +0800, Yu Chuan wrote:
Signed-off-by: Yu Chuan <13186087857@163.com> --- sparrow/4-docker/buildall | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
Reviewed-by: Liu Yinsi <liuyinsi@163.com>
diff --git a/sparrow/4-docker/buildall b/sparrow/4-docker/buildall index eb245008ad45..43a3a06e4222 100755 --- a/sparrow/4-docker/buildall +++ b/sparrow/4-docker/buildall @@ -8,18 +8,13 @@ export action=$1 build_depends() { local container=$1 - local should_wait=$2
for dep in $(cat $container/*-depends 2> /dev/null) do - build_depends $CONTAINER_PATH/$dep block_wait + build_depends $CONTAINER_PATH/$dep done
- if [ -n "$should_wait" ]; then - do_one $container - else - do_one $container & - fi + do_one $container }
do_one() @@ -44,7 +39,7 @@ tmpdir=$(mktemp -d)
for dir in $CONTAINER_PATH/*/ do - build_depends $dir + build_depends $dir & done
wait -- 2.23.0

On Tue, Dec 15, 2020 at 10:40:12AM +0800, Yu Chuan wrote:
Signed-off-by: Yu Chuan <13186087857@163.com> --- sparrow/4-docker/buildall | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/sparrow/4-docker/buildall b/sparrow/4-docker/buildall index eb245008ad45..43a3a06e4222 100755 --- a/sparrow/4-docker/buildall +++ b/sparrow/4-docker/buildall @@ -8,18 +8,13 @@ export action=$1 build_depends() { local container=$1 - local should_wait=$2
for dep in $(cat $container/*-depends 2> /dev/null) do - build_depends $CONTAINER_PATH/$dep block_wait + build_depends $CONTAINER_PATH/$dep done
To enable concurrency in independent containers, it can be: for dep in $(cat $container/*-depends 2> /dev/null) do build_depends $CONTAINER_PATH/$dep & done wait Thnaks, Xijian

build_depends() { local container=$1 - local should_wait=$2
for dep in $(cat $container/*-depends 2> /dev/null) do - build_depends $CONTAINER_PATH/$dep block_wait + build_depends $CONTAINER_PATH/$dep done
To enable concurrency in independent containers, it can be:
for dep in $(cat $container/*-depends 2> /dev/null) do build_depends $CONTAINER_PATH/$dep & done
wait
Good point !! -------- Thanks Yu Chuan
Thnaks, Xijian
participants (3)
-
Liu Yinsi
-
Xu Xijian
-
Yu Chuan