[PATCH v3 compass-ci] sparrow/4-docker: fix logical error

before: if execute ./buildall and docker images exist, then ./build after: if execute ./buildall or docker images not exist, then ./build Signed-off-by: Liu Yinsi <liuyinsi@163.com> --- sparrow/4-docker/buildall | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sparrow/4-docker/buildall b/sparrow/4-docker/buildall index f24226c..77fe43a 100755 --- a/sparrow/4-docker/buildall +++ b/sparrow/4-docker/buildall @@ -33,7 +33,7 @@ do_one() cd "$container" [ "$container_name" == 'ssh-r' ] && exit docker images | grep -wq "$container_name" - if [ "$?" == 0 ] && [ "$action" != "reboot" ]; then + if [ "$?" -ne 0 ] || [ "$action" != "reboot" ]; then [ -x build ] && ./build [ -x install ] && ./install fi -- 2.23.0

Reviewed by xijian <hdxuxijian@163.com> On Wed, Jan 13, 2021 at 03:27:50PM +0800, Liu Yinsi wrote:
before: if execute ./buildall and docker images exist, then ./build after: if execute ./buildall or docker images not exist, then ./build
Signed-off-by: Liu Yinsi <liuyinsi@163.com> --- sparrow/4-docker/buildall | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sparrow/4-docker/buildall b/sparrow/4-docker/buildall index f24226c..77fe43a 100755 --- a/sparrow/4-docker/buildall +++ b/sparrow/4-docker/buildall @@ -33,7 +33,7 @@ do_one() cd "$container" [ "$container_name" == 'ssh-r' ] && exit docker images | grep -wq "$container_name" - if [ "$?" == 0 ] && [ "$action" != "reboot" ]; then + if [ "$?" -ne 0 ] || [ "$action" != "reboot" ]; then [ -x build ] && ./build [ -x install ] && ./install fi -- 2.23.0

Reviewed-by: Wang Chenglong <18509160991@163.com> On Wed, Jan 13, 2021 at 03:27:50PM +0800, Liu Yinsi wrote:
before: if execute ./buildall and docker images exist, then ./build after: if execute ./buildall or docker images not exist, then ./build
Signed-off-by: Liu Yinsi <liuyinsi@163.com> --- sparrow/4-docker/buildall | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sparrow/4-docker/buildall b/sparrow/4-docker/buildall index f24226c..77fe43a 100755 --- a/sparrow/4-docker/buildall +++ b/sparrow/4-docker/buildall @@ -33,7 +33,7 @@ do_one() cd "$container" [ "$container_name" == 'ssh-r' ] && exit docker images | grep -wq "$container_name" - if [ "$?" == 0 ] && [ "$action" != "reboot" ]; then + if [ "$?" -ne 0 ] || [ "$action" != "reboot" ]; then [ -x build ] && ./build [ -x install ] && ./install fi -- 2.23.0

On Wed, Jan 13, 2021 at 03:27:50PM +0800, Liu Yinsi wrote:
before: if execute ./buildall and docker images exist, then ./build after: if execute ./buildall or docker images not exist, then ./build
Signed-off-by: Liu Yinsi <liuyinsi@163.com> --- sparrow/4-docker/buildall | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sparrow/4-docker/buildall b/sparrow/4-docker/buildall index f24226c..77fe43a 100755 --- a/sparrow/4-docker/buildall +++ b/sparrow/4-docker/buildall @@ -33,7 +33,7 @@ do_one() cd "$container" [ "$container_name" == 'ssh-r' ] && exit
docker images | grep -wq "$container_name" - if [ "$?" == 0 ] && [ "$action" != "reboot" ]; then + if [ "$?" -ne 0 ] || [ "$action" != "reboot" ]; then [ -x build ] && ./build [ -x install ] && ./install fi
it looks too difficult to understand. how about the follow: docker images | grep -wq "$container_name" || { [ "$action" == "reboot" ] || { [ -x build ] && ./build [ -x install ] && ./install } } -------- Thanks Yu Chuan
-- 2.23.0

it looks too difficult to understand. how about the follow:
docker images | grep -wq "$container_name" || { [ "$action" == "reboot" ] || { [ -x build ] && ./build [ -x install ] && ./install } }
ok, but if we can get all images names, just grep docker images names, not exist ->./build exist -> skip ./build delete "action" == "reboot", but some images name is not same with container_name, like scheduler, docker images name is sch-ruby-a:v0.00d-#{SCHED_PORT}, would you have any idea? Thanks, Yinsi
-------- Thanks Yu Chuan
-- 2.23.0

+ if [ "$?" -ne 0 ] || [ "$action" != "reboot" ]; then
it looks too difficult to understand. how about the follow:
docker images | grep -wq "$container_name" || { [ "$action" == "reboot" ] || {
this logics is images not exist and action=reboot, not build, but our purpose is images not exist, build images Thanks, Yinsi
[ -x build ] && ./build [ -x install ] && ./install } }
-------- Thanks Yu Chuan
-- 2.23.0

On Wed, Jan 13, 2021 at 03:27:50PM +0800, Liu Yinsi wrote:
before: if execute ./buildall and docker images exist, then ./build after: if execute ./buildall or docker images not exist, then ./build
Pls give the [why] and [how]. Thanks, Xueliang
Signed-off-by: Liu Yinsi <liuyinsi@163.com> --- sparrow/4-docker/buildall | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sparrow/4-docker/buildall b/sparrow/4-docker/buildall index f24226c..77fe43a 100755 --- a/sparrow/4-docker/buildall +++ b/sparrow/4-docker/buildall @@ -33,7 +33,7 @@ do_one() cd "$container" [ "$container_name" == 'ssh-r' ] && exit docker images | grep -wq "$container_name" - if [ "$?" == 0 ] && [ "$action" != "reboot" ]; then + if [ "$?" -ne 0 ] || [ "$action" != "reboot" ]; then [ -x build ] && ./build [ -x install ] && ./install fi -- 2.23.0

On Thu, Jan 14, 2021 at 10:56:33AM +0800, Cao Xueliang wrote:
On Wed, Jan 13, 2021 at 03:27:50PM +0800, Liu Yinsi wrote:
before: if execute ./buildall and docker images exist, then ./build after: if execute ./buildall or docker images not exist, then ./build
Pls give the [why] and [how].
ok Thanks, Yinsi
Thanks, Xueliang
Signed-off-by: Liu Yinsi <liuyinsi@163.com> --- sparrow/4-docker/buildall | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sparrow/4-docker/buildall b/sparrow/4-docker/buildall index f24226c..77fe43a 100755 --- a/sparrow/4-docker/buildall +++ b/sparrow/4-docker/buildall @@ -33,7 +33,7 @@ do_one() cd "$container" [ "$container_name" == 'ssh-r' ] && exit docker images | grep -wq "$container_name" - if [ "$?" == 0 ] && [ "$action" != "reboot" ]; then + if [ "$?" -ne 0 ] || [ "$action" != "reboot" ]; then [ -x build ] && ./build [ -x install ] && ./install fi -- 2.23.0
participants (5)
-
Cao Xueliang
-
Liu Yinsi
-
Wang Chenglong
-
Xu Xijian
-
Yu Chuan