Skip to content

Commit

Permalink
Upgrade to latest PyPy release.
Browse files Browse the repository at this point in the history
Also fix and simplify dtox volume mount permissions adjustment in the
face of docker behavior changes. This new method should be robust to
subtle semantic shifts since it operates after a `docker build` and
fully in `docker run` context taking its cue from the `CACHE_MODE=pull`
method of doing this.
  • Loading branch information
jsirois committed Apr 28, 2024
1 parent 41ad944 commit 9247266
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
6 changes: 3 additions & 3 deletions docker/base/install_pythons.sh
Expand Up @@ -18,13 +18,13 @@ PYENV_VERSIONS=(
3.10.14
3.12.3
3.13.0a6
pypy2.7-7.3.15
pypy2.7-7.3.16
pypy3.5-7.0.0
pypy3.6-7.3.3
pypy3.7-7.3.9
pypy3.8-7.3.11
pypy3.9-7.3.15
pypy3.10-7.3.15
pypy3.9-7.3.16
pypy3.10-7.3.16
)
git clone "${PYENV_REPO:-https://github.com/pyenv/pyenv.git}" "${PYENV_ROOT}" && (
cd "${PYENV_ROOT}" && git checkout "${PYENV_SHA:-HEAD}" && src/configure && make -C src
Expand Down
11 changes: 0 additions & 11 deletions docker/user/Dockerfile
Expand Up @@ -25,17 +25,6 @@ ENV _PEX_TEST_DEV_ROOT=/development/pex_dev
# ~/.pex cache.
VOLUME "/home/${USER}/.pex"

RUN mkdir -p \
/development/pex \
/development/pex/.tox \
/development/pex_dev \
"/home/${USER}/.pex" && \
chown -R "${UID}:${GID}" \
/development/pex \
/development/pex/.tox \
/development/pex_dev \
"/home/${USER}/.pex"

# This will be a named volume used to persist the pytest tmp tree (/tmp/pytest-of-$USER/) for use \
# in `./dtox inspect` sessions.
VOLUME /tmp
Expand Down
23 changes: 18 additions & 5 deletions dtox.sh
Expand Up @@ -27,6 +27,7 @@ elif [[ "${BASE_MODE}" == "pull" ]]; then
docker pull "ghcr.io/pex-tool/pex/base:${base_hash}"
fi

CONTAINER_HOME="/home/$(id -un)"
USER_INPUT=(
"${BASE_INPUT[@]}"
"${ROOT}/docker/user/Dockerfile"
Expand All @@ -48,6 +49,23 @@ if [[ -z "$(user_image_id)" ]]; then
--tag pex-tool/pex/user:latest \
--tag "pex-tool/pex/user:${user_hash}" \
"${ROOT}/docker/user"

docker run \
--rm \
--volume pex-caches:/development/pex_dev \
--volume "pex-root:${CONTAINER_HOME}/.pex" \
--volume pex-tmp:/tmp \
--volume pex-tox:/development/pex/.tox \
--entrypoint bash \
--user root \
"pex-tool/pex/user:${user_hash}" \
-c "
chown -R $(id -un):$(id -gn) \
/development/pex_dev \
${CONTAINER_HOME}/.pex \
/tmp \
/development/pex/.tox
"
fi

if [[ "${CACHE_MODE}" == "pull" ]]; then
Expand Down Expand Up @@ -99,11 +117,6 @@ if [[ -n "${TERM:-}" ]]; then
)
fi

# This ensures the current user owns the host .tox/ dir before launching the container, which
# otherwise sets the ownership as root for undetermined reasons
mkdir -p "${ROOT}/.tox"

CONTAINER_HOME="/home/$(id -un)"
exec docker run \
--rm \
--volume pex-tmp:/tmp \
Expand Down

0 comments on commit 9247266

Please sign in to comment.