From 30f426f4430896fda954dae57f7cd2bf386ed2f2 Mon Sep 17 00:00:00 2001 From: Jian Chen Date: Fri, 21 Jun 2024 12:16:45 -0700 Subject: [PATCH] fix reviewDog --- .../ci_build/github/linux/run_dockerbuild.sh | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/tools/ci_build/github/linux/run_dockerbuild.sh b/tools/ci_build/github/linux/run_dockerbuild.sh index 13e187b28c7a6..c51a40ee4d0fc 100755 --- a/tools/ci_build/github/linux/run_dockerbuild.sh +++ b/tools/ci_build/github/linux/run_dockerbuild.sh @@ -20,7 +20,7 @@ ORTMODULE_BUILD=false #Training only USE_CONDA=false ALLOW_RELEASED_ONNX_OPSET_ONLY_ENV="ALLOW_RELEASED_ONNX_OPSET_ONLY="$ALLOW_RELEASED_ONNX_OPSET_ONLY -echo "ALLOW_RELEASED_ONNX_OPSET_ONLY environment variable is set as "$ALLOW_RELEASED_ONNX_OPSET_ONLY_ENV +echo "ALLOW_RELEASED_ONNX_OPSET_ONLY environment variable is set as $ALLOW_RELEASED_ONNX_OPSET_ONLY_ENV" while getopts o:d:p:x:v:y:t:i:mue parameter_Option do case "${parameter_Option}" @@ -48,9 +48,11 @@ m) INSTALL_DEPS_DISTRIBUTED_SETUP=true;; u) ORTMODULE_BUILD=true;; # install and use conda e) USE_CONDA=true;; +*) echo "Invalid option";; esac done +# shellcheck disable=SC2034 EXIT_CODE=1 DEFAULT_PYTHON_VER="3.8" @@ -69,19 +71,19 @@ if [[ $BUILD_OS == ubuntu* ]]; then fi NEED_BUILD_SHARED_LIB=true -cd $SCRIPT_DIR/docker -if [ $BUILD_OS = "yocto" ]; then +cd "$SCRIPT_DIR"/docker +if [ "$BUILD_OS" = "yocto" ]; then IMAGE="arm-yocto-$YOCTO_VERSION" DOCKER_FILE=Dockerfile.ubuntu_for_arm # ACL 19.05 need yocto 4.19 TOOL_CHAIN_SCRIPT=fsl-imx-xwayland-glibc-x86_64-fsl-image-qt5-aarch64-toolchain-4.19-warrior.sh - if [ $YOCTO_VERSION = "4.14" ]; then + if [ "$YOCTO_VERSION" = "4.14" ]; then TOOL_CHAIN_SCRIPT=fsl-imx-xwayland-glibc-x86_64-fsl-image-qt5-aarch64-toolchain-4.14-sumo.sh fi $GET_DOCKER_IMAGE_CMD --repository "onnxruntime-$IMAGE" \ --docker-build-args="--build-arg TOOL_CHAIN=$TOOL_CHAIN_SCRIPT --build-arg BUILD_USER=onnxruntimedev --build-arg BUILD_UID=$(id -u) --build-arg PYTHON_VERSION=${PYTHON_VER}" \ --dockerfile $DOCKER_FILE --context . -elif [ $BUILD_DEVICE = "gpu" ]; then +elif [ "$BUILD_DEVICE" = "gpu" ]; then # This code path is only for training. Inferecing pipeline uses CentOS IMAGE="$BUILD_OS-gpu_training" # Current build script doesn't support building shared lib with Python dependency. To enable building with PythonOp, @@ -122,10 +124,11 @@ set +e mkdir -p ~/.onnx if [ -z "$NIGHTLY_BUILD" ]; then + # shellcheck disable=SC2121 set NIGHTLY_BUILD=0 fi -if [ $BUILD_DEVICE = "cpu" ] || [ $BUILD_DEVICE = "openvino" ] || [ $BUILD_DEVICE = "arm" ]; then +if [ "$BUILD_DEVICE" = "cpu" ] || [ "$BUILD_DEVICE" = "openvino" ] || [ "$BUILD_DEVICE" = "arm" ]; then RUNTIME= else RUNTIME="--gpus all" @@ -137,13 +140,13 @@ DOCKER_RUN_PARAMETER="--volume $SOURCE_ROOT:/onnxruntime_src \ --volume /data/onnx:/data/onnx:ro \ --volume $HOME/.cache/onnxruntime:/home/onnxruntimedev/.cache/onnxruntime \ --volume $HOME/.onnx:/home/onnxruntimedev/.onnx" -if [ $BUILD_DEVICE = "openvino" ] && [[ $BUILD_EXTR_PAR == *"--use_openvino GPU_FP"* ]]; then +if [ "$BUILD_DEVICE" = "openvino" ] && [[ $BUILD_EXTR_PAR == *"--use_openvino GPU_FP"* ]]; then DOCKER_RUN_PARAMETER="$DOCKER_RUN_PARAMETER --device /dev/dri:/dev/dri" fi # Though this command has a yocto version argument, none of our ci build pipelines use yocto. -$DOCKER_CMD run $RUNTIME --rm $DOCKER_RUN_PARAMETER \ +$DOCKER_CMD run "$RUNTIME" --rm "$DOCKER_RUN_PARAMETER" \ -e NIGHTLY_BUILD \ - -e $ALLOW_RELEASED_ONNX_OPSET_ONLY_ENV \ + -e "$ALLOW_RELEASED_ONNX_OPSET_ONLY_ENV" \ "onnxruntime-$IMAGE" \ /bin/bash /onnxruntime_src/tools/ci_build/github/linux/run_build.sh \ - -d $BUILD_DEVICE -x "$BUILD_EXTR_PAR" -o $BUILD_OS -y $YOCTO_VERSION + -d "$BUILD_DEVICE" -x "$BUILD_EXTR_PAR" -o "$BUILD_OS" -y "$YOCTO_VERSION"