Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow use of docker/lint.sh clang_format with git-worktree #8639

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions docker/bash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ if [ "$#" -lt 1 ]; then
exit -1
fi

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
WORKSPACE="$(pwd)"

if [ "$1" == "--repo-mount-point" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to add this on line 23 small documentation to the command line, also to show the order in which parameters need to be provided.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

shift
REPO_MOUNT_POINT="$1"
shift
else
REPO_MOUNT_POINT="${WORKSPACE}"
fi

DOCKER_IMAGE_NAME=$(lookup_image_spec "$1")
if [ -z "${DOCKER_IMAGE_NAME}" ]; then
DOCKER_IMAGE_NAME=("$1")
Expand All @@ -70,7 +81,7 @@ if [ "$#" -eq 1 ]; then
if [[ $(uname) == "Darwin" ]]; then
# Docker's host networking driver isn't supported on macOS.
# Use default bridge network and expose port for jupyter notebook.
CI_DOCKER_EXTRA_PARAMS+=( "${CI_DOCKER_EXTRA_PARAMS[@]}" "-p 8888:8888" )
CI_DOCKER_EXTRA_PARAMS=( "${CI_DOCKER_EXTRA_PARAMS[@]}" "-p" "8888:8888" )
else
CI_DOCKER_EXTRA_PARAMS+=( "${CI_DOCKER_EXTRA_PARAMS[@]}" "--net=host" )
fi
Expand All @@ -83,9 +94,6 @@ if [ $interactive -eq 1 ]; then
CI_DOCKER_EXTRA_PARAMS=( "${CI_DOCKER_EXTRA_PARAMS[@]}" -it )
fi

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
WORKSPACE="$(pwd)"

# Use nvidia-docker if the container is GPU.
if [[ ! -z $CUDA_VISIBLE_DEVICES ]]; then
CUDA_ENV="-e CUDA_VISIBLE_DEVICES=${CUDA_VISIBLE_DEVICES}"
Expand Down Expand Up @@ -160,12 +168,12 @@ fi
${DOCKER_BINARY} run --rm --pid=host\
${DOCKER_DEVICES}\
${WORKSPACE_VOLUMES}\
-v ${WORKSPACE}:/workspace \
-v ${WORKSPACE}:${REPO_MOUNT_POINT} \
-v ${SCRIPT_DIR}:/docker \
"${CI_DOCKER_MOUNT_CMD[@]}" \
"${EXTRA_MOUNTS[@]}" \
-w /workspace \
-e "CI_BUILD_HOME=/workspace" \
-w "${REPO_MOUNT_POINT}" \
-e "CI_BUILD_HOME=${REPO_MOUNT_POINT}" \
-e "CI_BUILD_USER=$(id -u -n)" \
-e "CI_BUILD_UID=$(id -u)" \
-e "CI_BUILD_GROUP=$(id -g -n)" \
Expand Down