Skip to content

Commit

Permalink
chore(build-tool): fixes for shellcheck (#11287)
Browse files Browse the repository at this point in the history
  • Loading branch information
everpcpc authored May 1, 2023
1 parent 6bb96a2 commit 47504dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions scripts/setup/run_build_tool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ INTERACTIVE="${INTERACTIVE:-true}"
CARGO_HOME="${CARGO_HOME:-$HOME/.cargo}"
BYPASS_ENV_VARS="${BYPASS_ENV_VARS:-RUSTFLAGS,RUST_LOG}"
ENABLE_SCCACHE="${ENABLE_SCCACHE:-false}"
COMMAND="$@"
COMMAND="$*"
TOOLCHAIN_VERSION=$(awk -F'[ ="]+' '$1 == "channel" { print $2 }' rust-toolchain.toml)

_UID=$(id -u)
Expand All @@ -24,7 +24,7 @@ else
USER=${USER:-$(whoami)}
IMAGE="${USER}/build-tool:${TARGET}-${TOOLCHAIN_VERSION}"

if [[ "$(docker image ls ${IMAGE} --format="true")" ]]; then
if [[ $(docker image ls "${IMAGE}" --format="true") ]]; then
echo "==> build-tool using image ${IMAGE}"
else
echo "==> preparing temporary build-tool image ${IMAGE} ..."
Expand All @@ -34,8 +34,8 @@ FROM datafuselabs/build-tool:${TARGET}-${TOOLCHAIN_VERSION}
RUN useradd -u ${_UID} ${USER}
RUN printf "${USER} ALL=(ALL:ALL) NOPASSWD:ALL\\n" > /etc/sudoers.d/databend
EOF
docker build -t ${IMAGE} ${tmpdir}
rm -rf ${tmpdir}
docker build -t "${IMAGE}" "${tmpdir}"
rm -rf "${tmpdir}"
fi
fi

Expand All @@ -44,7 +44,7 @@ mkdir -p "${CARGO_HOME}/git"
mkdir -p "${CARGO_HOME}/registry"

if [[ $INTERACTIVE == "true" ]]; then
echo "==> building interactive..." >&2
echo "==> build-tool with interactive..." >&2
EXTRA_ARGS="--interactive --env TERM=xterm-256color"
fi

Expand All @@ -58,6 +58,7 @@ if [[ $ENABLE_SCCACHE == "true" ]]; then
COMMAND="${COMMAND} && sccache --show-stats"
fi

# shellcheck disable=SC2086
exec docker run --rm --tty --net=host ${EXTRA_ARGS} \
--user "${_UID}:${_GID}" \
--volume "${CARGO_HOME}/registry:/opt/rust/cargo/registry" \
Expand Down
4 changes: 2 additions & 2 deletions scripts/setup/rust-tools.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cargo-audit@0.17.4
cargo-audit@0.17.5
cargo-machete@0.5.0
taplo-cli@0.8.0
typos-cli@1.13.10
typos-cli@1.14.8

1 comment on commit 47504dc

@vercel
Copy link

@vercel vercel bot commented on 47504dc May 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

databend – ./

databend.vercel.app
databend-git-main-databend.vercel.app
databend.rs
databend-databend.vercel.app

Please sign in to comment.