[PATCH v2 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 | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/sparrow/4-docker/buildall b/sparrow/4-docker/buildall index eb245008ad45..a9269e03a550 100755 --- a/sparrow/4-docker/buildall +++ b/sparrow/4-docker/buildall @@ -8,18 +8,14 @@ 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 + wait - if [ -n "$should_wait" ]; then - do_one $container - else - do_one $container & - fi + do_one $container } do_one() @@ -44,8 +40,8 @@ tmpdir=$(mktemp -d) for dir in $CONTAINER_PATH/*/ do - build_depends $dir + build_depends $dir & done - wait + rm -fr $tmpdir -- 2.23.0

Reviewed-by: Liu Yinsi <liuyinsi@163.com> On Tue, Dec 15, 2020 at 06:10:06PM +0800, Yu Chuan wrote:
Signed-off-by: Yu Chuan <13186087857@163.com> --- sparrow/4-docker/buildall | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/sparrow/4-docker/buildall b/sparrow/4-docker/buildall index eb245008ad45..a9269e03a550 100755 --- a/sparrow/4-docker/buildall +++ b/sparrow/4-docker/buildall @@ -8,18 +8,14 @@ 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 + wait
- if [ -n "$should_wait" ]; then - do_one $container - else - do_one $container & - fi + do_one $container }
do_one() @@ -44,8 +40,8 @@ tmpdir=$(mktemp -d)
for dir in $CONTAINER_PATH/*/ do - build_depends $dir + build_depends $dir & done - wait + rm -fr $tmpdir -- 2.23.0
participants (2)
-
Liu Yinsi
-
Yu Chuan