Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
25 changes: 13 additions & 12 deletions docker/run_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CUROBO_VERSION_TAG='sim-6.1.0-curobo'
# Resolve TORCH_CUDA_ARCH_LIST for the cuRobo build. Honour an explicit override if set, else
# auto-detect the host GPU's compute capability via nvidia-smi (e.g. "12.0" -> "12.0+PTX").
detect_cuda_arch() {
if [ -n "${TORCH_CUDA_ARCH_LIST:-}" ]; then
if [[ -n "${TORCH_CUDA_ARCH_LIST:-}" ]]; then
echo "${TORCH_CUDA_ARCH_LIST}"
return 0
fi
Expand Down Expand Up @@ -75,12 +75,13 @@ while getopts ":d:crRvh" OPTION; do
;;
\?) echo "Invalid option: -$OPTARG" >&2; exit 1 ;;
:) echo "Option -$OPTARG requires an argument." >&2; exit 1 ;;
*) echo "Unhandled option: -$OPTION" >&2; exit 1 ;;
esac
done
shift $((OPTIND - 1))

# Set separate tag for cuRobo image.
if [ "$INSTALL_CUROBO" = "true" ]; then
if [[ "$INSTALL_CUROBO" == true ]]; then
DOCKER_VERSION_TAG="${CUROBO_VERSION_TAG}"
fi

Expand All @@ -89,11 +90,11 @@ CONTAINER_NAME="${DOCKER_IMAGE_NAME}-${DOCKER_VERSION_TAG}"
echo "Using Docker image: ${DOCKER_IMAGE_NAME}:${DOCKER_VERSION_TAG} (base: ${BASE_IMAGE})"

# Build the image if it doesn't exist yet, or if a rebuild was requested.
if [ "$(docker images -q "${DOCKER_IMAGE_NAME}:${DOCKER_VERSION_TAG}" 2>/dev/null)" ] && [ "$FORCE_REBUILD" = false ]; then
if [[ -n "$(docker images -q "${DOCKER_IMAGE_NAME}:${DOCKER_VERSION_TAG}" 2>/dev/null)" && "$FORCE_REBUILD" == false ]]; then
echo "Image ${DOCKER_IMAGE_NAME}:${DOCKER_VERSION_TAG} already exists. Use -r to force a rebuild."
else
BUILD_ARGS=("--build-arg" "WORKDIR=${WORKDIR}" "--build-arg" "BASE_IMAGE=${BASE_IMAGE}")
if [ "$INSTALL_CUROBO" = "true" ]; then
if [[ "$INSTALL_CUROBO" == true ]]; then
# Detect the host GPU arch so cuRobo's kernels are compiled for it.
ARCH_LIST=$(detect_cuda_arch) || exit 1
echo "cuRobo enabled — building for TORCH_CUDA_ARCH_LIST=${ARCH_LIST}"
Expand All @@ -109,18 +110,18 @@ else
fi

# Remove a previously-exited container of the same name so we can recreate it.
if [ "$(docker ps -a --quiet --filter status=exited --filter "name=^${CONTAINER_NAME}$")" ]; then
if [[ -n "$(docker ps -a --quiet --filter status=exited --filter "name=^${CONTAINER_NAME}$")" ]]; then
docker rm "${CONTAINER_NAME}" >/dev/null
fi

# Reuse a running container only if it uses the selected image.
if [ "$(docker container inspect -f '{{.State.Running}}' "${CONTAINER_NAME}" 2>/dev/null)" = "true" ]; then
if [ "$(docker inspect -f '{{.Image}}' "${CONTAINER_NAME}")" != \
"$(docker image inspect -f '{{.Id}}' "${DOCKER_IMAGE_NAME}:${DOCKER_VERSION_TAG}")" ]; then
if test "$(docker container inspect -f '{{.State.Running}}' "${CONTAINER_NAME}" 2>/dev/null)" = true; then
if test "$(docker inspect -f '{{.Image}}' "${CONTAINER_NAME}")" != \
"$(docker image inspect -f '{{.Id}}' "${DOCKER_IMAGE_NAME}:${DOCKER_VERSION_TAG}")"; then
echo "error: ${CONTAINER_NAME} uses an older image. Stop it and rerun this command." >&2
exit 1
fi
if [ "$#" -gt 0 ]; then
if [[ $# -gt 0 ]]; then
printf -v AUTODATA_COMMAND '%q ' "$@"
docker exec --user "$(id -un)" --workdir "${WORKDIR}" "${CONTAINER_NAME}" \
bash -ic "${AUTODATA_COMMAND}"
Expand All @@ -132,15 +133,15 @@ if [ "$(docker container inspect -f '{{.State.Running}}' "${CONTAINER_NAME}" 2>/
fi

add_volume_if_it_exists() {
[ -d "$1" ] && echo "-v $1:$2"
[[ -d "$1" ]] && echo "-v $1:$2"
}

# Create it as the host user before Docker can create a root-owned bind source.
mkdir -p "${CACHE_HOST_MOUNT_DIRECTORY}"

# Forward the host SSH agent if available (so git over SSH works in-container).
SSH_DOCKER_ARGS=()
if [ -n "${SSH_AUTH_SOCK:-}" ] && [ -S "$SSH_AUTH_SOCK" ]; then
if [[ -n "${SSH_AUTH_SOCK:-}" && -S "$SSH_AUTH_SOCK" ]]; then
SSH_DOCKER_ARGS+=("-v" "$SSH_AUTH_SOCK:/ssh-agent" "--env" "SSH_AUTH_SOCK=/ssh-agent")
fi

Expand Down Expand Up @@ -183,7 +184,7 @@ fi
# Only allocate a TTY when stdin is a terminal. CI has no TTY, and passing --tty
# there fails with "cannot attach stdin to a TTY-enabled container".
TTY_ARGS=()
if [ -t 0 ]; then
if [[ -t 0 ]]; then
TTY_ARGS+=("--tty")
fi

Expand Down
4 changes: 2 additions & 2 deletions docker/setup/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ chown "$DOCKER_RUN_USER_NAME:$DOCKER_RUN_GROUP_NAME" "/home/$DOCKER_RUN_USER_NAM

# Isaac Lab rejects a binary Sim link with an active virtual environment.
ISAACLAB_DIR="$WORKDIR/submodules/IsaacLab-Arena/submodules/IsaacLab"
if [ -e "$ISAACLAB_DIR/_isaac_sim" ] || [ -L "$ISAACLAB_DIR/_isaac_sim" ]; then
if [[ -e "$ISAACLAB_DIR/_isaac_sim" || -L "$ISAACLAB_DIR/_isaac_sim" ]]; then
echo "error: $ISAACLAB_DIR/_isaac_sim selects a binary Isaac Sim installation." >&2
echo "Remove the link from the host checkout before using the locked Docker environment." >&2
exit 1
fi

# Run the command as the dev user with the image's shell environment.
if [ $# -ge 1 ]; then
if [[ $# -ge 1 ]]; then
# Quote each argument before passing it to the interactive shell so shell
# preserves paths, marker expressions, and Python code.
printf -v AUTODATA_COMMAND '%q ' "$@"
Expand Down
6 changes: 3 additions & 3 deletions scripts/ci/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ cd "${REPO_ROOT}"

# cuRobo (-c) is required for the SkillGen tests; one image covers the whole suite.
RUN_DOCKER_ARGS=(-c)
if [ "${FORCE_REBUILD}" = "true" ]; then
if test "${FORCE_REBUILD}" = true; then
RUN_DOCKER_ARGS+=(-r)
fi

Expand All @@ -66,12 +66,12 @@ PYTEST_ARGS=(
"WARP_CACHE_PATH=${CONTAINER_CACHE_DIR}/warp"
python -m pytest -sv --durations=0
)
if [ -n "${RESULTS_DIR}" ]; then
if [[ -n "${RESULTS_DIR}" ]]; then
# Pre-create on the host so the container can write into the bind-mounted dir.
mkdir -p "${RESULTS_DIR}"
PYTEST_ARGS+=("--junitxml=${RESULTS_DIR}/junit.xml")
fi
if [ -n "${PYTEST_MARK}" ]; then
if [[ -n "${PYTEST_MARK}" ]]; then
PYTEST_ARGS+=(-m "${PYTEST_MARK}")
fi
# TEST_PATH may list multiple paths; split on whitespace into separate args.
Expand Down
Loading