Skip to content

Commit 2d4b21c

Browse files
committed
Update docker env and scripts
1 parent 56eae2e commit 2d4b21c

File tree

2 files changed

+7
-47
lines changed

2 files changed

+7
-47
lines changed

ci/envs/docker.env

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
os=$(uname -s | awk '{print tolower($0)}')
1818
arch=$(uname -m)
1919

20+
export JAXCI_DOCKER_ARGS=""
21+
export JAXCI_DOCKER_IMAGE=""
22+
2023
# TODO: Set GPU Docker args and GPU Docker images
2124
# Linux x86 specifc settings
2225
if [[ $os == "linux" ]] && [[ $arch == "x86_64" ]]; then
@@ -31,10 +34,4 @@ fi
3134
# Windows specific settings
3235
if [[ $os =~ "msys_nt" ]]; then
3336
export JAXCI_DOCKER_IMAGE="gcr.io/tensorflow-testing/tf-win2019-rbe@sha256:1082ef4299a72e44a84388f192ecefc81ec9091c146f507bc36070c089c0edcc"
34-
fi
35-
36-
# Mac specific settings
37-
if [[ $os == "macos" ]]; then
38-
# Mac builds do not run in Docker.
39-
export JAXCI_RUN_DOCKER_CONTAINER=0
4037
fi

ci/utilities/run_docker_container.sh

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -39,37 +39,11 @@ if ! docker container inspect jax >/dev/null 2>&1 ; then
3939
JAXCI_DOCKER_ARGS="$JAXCI_DOCKER_ARGS -v $HOME/.config/gcloud:/root/.config/gcloud"
4040
fi
4141

42-
# If XLA repository on the local system is to be used, map it to the container
43-
# and set the JAXCI_XLA_GIT_DIR environment variable to the container path.
44-
if [[ -n $JAXCI_XLA_GIT_DIR ]]; then
45-
JAXCI_DOCKER_ARGS="$JAXCI_DOCKER_ARGS -v $JAXCI_XLA_GIT_DIR:$JAXCI_DOCKER_WORK_DIR/xla -e JAXCI_XLA_GIT_DIR=$JAXCI_DOCKER_WORK_DIR/xla"
46-
fi
47-
48-
# Set the output directory to the container path.
49-
export JAXCI_OUTPUT_DIR=$JAXCI_DOCKER_WORK_DIR/dist
50-
51-
# Capture the environment variables that get set by JAXCI_ENV_FILE and store
52-
# them in a file. This is needed so that we know which envs to set when
53-
# setting up the Docker container in `setup_docker.sh`. An easier solution
54-
# would be to just grep for "JAXCI_" variables but unfortunately, this is not
55-
# robust as there are some variables such as `JAX_ENABLE_X64`, `NCCL_DEBUG`,
56-
# etc that are used by JAX but do not have the `JAXCI_` prefix.
57-
envs_after=$(mktemp)
58-
env > "$envs_after"
59-
60-
jax_ci_envs=$(mktemp)
61-
62-
# Only get the new environment variables set by JAXCI_ENV_FILE. Use
63-
# "env_before" that gets set in setup.sh for the initial environment
64-
# variables. diff exits with a return code. This can end the build abrupty so
65-
# we use "|| true" to ignore the return code and continue.
66-
diff <(sort "$envs_before") <(sort "$envs_after") | grep "^> " | sed 's/^> //' | grep -v "^BASH_FUNC" > "$jax_ci_envs" || true
67-
6842
# Start the container. `user_set_jaxci_envs` is read after `jax_ci_envs` to
6943
# allow the user to override any environment variables set by JAXCI_ENV_FILE.
70-
docker run --env-file $jax_ci_envs --env-file "$user_set_jaxci_envs" $JAXCI_DOCKER_ARGS --name jax \
71-
-w $JAXCI_DOCKER_WORK_DIR -itd --rm \
72-
-v "$JAXCI_JAX_GIT_DIR:$JAXCI_DOCKER_WORK_DIR" \
44+
docker run $JAXCI_DOCKER_ARGS --name jax \
45+
-w /jax -itd --rm \
46+
-v "$JAXCI_JAX_GIT_DIR:/jax" \
7347
"$JAXCI_DOCKER_IMAGE" \
7448
bash
7549

@@ -78,15 +52,4 @@ if ! docker container inspect jax >/dev/null 2>&1 ; then
7852
CONTAINER_IP_ADDR=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' jax)
7953
netsh advfirewall firewall add rule name="Allow Metadata Proxy" dir=in action=allow protocol=TCP localport=80 remoteip="$CONTAINER_IP_ADDR"
8054
fi
81-
fi
82-
83-
# Update `JAXCI_OUTPUT_DIR`, `JAXCI_JAX_GIT_DIR` and `JAXCI_XLA_GIT_DIR` with
84-
# the new Docker path on the host shell environment. This is needed because when
85-
# running in Docker with `docker exec`, the commands are run on the host shell
86-
# environment and as such the following variables need to be updated with The
87-
# Docker paths.
88-
export JAXCI_OUTPUT_DIR=$JAXCI_DOCKER_WORK_DIR/dist
89-
export JAXCI_JAX_GIT_DIR=$JAXCI_DOCKER_WORK_DIR
90-
export JAXCI_XLA_GIT_DIR=$JAXCI_DOCKER_WORK_DIR/xla
91-
92-
git config --global --add safe.directory $JAXCI_DOCKER_WORK_DIR
55+
fi

0 commit comments

Comments
 (0)