Skip to content

Commit 285d70d

Browse files
committed
Revert "Build: hardcode the Docker username for now (#10172)"
This reverts commit 331e474.
1 parent f141a8f commit 285d70d

File tree

1 file changed

+8
-26
lines changed

1 file changed

+8
-26
lines changed

readthedocs/doc_builder/environments.py

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -312,33 +312,15 @@ def run(self):
312312
# /home/docs/.asdf/shims:/home/docs/.asdf/bin
313313
# :/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
314314
# docs@bfe702e31cdd:~$
315-
#
316-
# On old Docker images we have different PATH:
317-
#
318-
# $ sudo docker run -it readthedocs/build:latest /bin/bash
319-
# docs@656e38a30fa4:/$ echo $PATH
320-
# /home/docs/.pyenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/docs/.conda/bin:/home/docs/.pyenv/bin
321-
# docs@656e38a30fa4:/$
315+
asdf_paths = (
316+
f"/home/{settings.RTD_DOCKER_USER}/.asdf/shims"
317+
f":/home/{settings.RTD_DOCKER_USER}/.asdf/bin"
318+
)
319+
if settings.RTD_DOCKER_COMPOSE:
320+
asdf_paths += ":/root/.asdf/shims:/root/.asdf/bin"
321+
322322
default_paths = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
323-
if self.build_env.container_image in (
324-
"readthedocs/build:ubuntu-22.04",
325-
"readthedocs/build:ubuntu-20.04",
326-
):
327-
# Use ASDF path for newer images
328-
python_paths = "/home/docs/.asdf/shims:/home/docs/.asdf/bin"
329-
paths = f"{python_paths}:{default_paths}"
330-
331-
# On local development, we are using root user
332-
if settings.RTD_DOCKER_COMPOSE:
333-
paths = paths.replace("/home/docs/", "/root/")
334-
else:
335-
# Use PYENV for older images
336-
paths = (
337-
"/home/docs/.pyenv/shims:/home/docs/.cargo/bin"
338-
f":{default_paths}:"
339-
"/home/docs/.conda/bin:/home/docs/.pyenv/bin"
340-
)
341-
environment["PATH"] = paths
323+
environment["PATH"] = f"{asdf_paths}:{default_paths}"
342324

343325
# Prepend the BIN_PATH if it's defined
344326
if self.bin_path:

0 commit comments

Comments
 (0)