
+ +def docker_skip_rebuild(tag) + if ENV.include? 'DOCKER_SKIP_REBUILD' + exit 1 if system "docker image inspect #{tag} > /dev/null 2>&1" + end
you should aviod nested 'if' structure, as follow:
return unless ENV.include? 'DOCKER_SKIP_REBUILD' exit 1 if system "docker image inspect #{tag} > /dev/null 2>&1"
good Thanks, Yinsi
Thanks, Liushaofei
+end
diff --git a/container/defconfig.sh b/container/defconfig.sh index 54e65b5..7612e2d 100755 --- a/container/defconfig.sh +++ b/container/defconfig.sh @@ -41,3 +41,12 @@ push_image() docker tag "$src_tag" "$dst_tag" docker push "$dst_tag" } + +docker_skip_rebuild() +{ + tag=$1 + [ $DOCKER_SKIP_REBUILD ] && { + docker image inspect $tag > /dev/null 2>&1 + [ "$?" == "0" ] && exit 1 + } +} -- 2.23.0