Skip to content

Commit

Permalink
Pin test_package_pex_environment's image to a particular sha (#19324)
Browse files Browse the repository at this point in the history
This pins the docker image used in
`src/python/pants/backend/docker/util_rules/docker_build_context_test.py:test_packaged_pex_environment`
to
https://hub.docker.com/layers/library/python/3.8-buster/images/sha256-bc4b9fb034a871b285bea5418cedfcaa9d2ab5590fb5fb6f0c42aaebb2e2c911?context=explore,
which is (at the time of writing) the most recent `3.8-buster` image.

This test has recently started failing with an error when building
`psutil`:

```
E         psutil/_psutil_common.c:9:10: fatal error: Python.h: No such file or directory
E             9 | #include <Python.h>
E               |          ^~~~~~~~~~
E         compilation terminated.
E         error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
E         ----------------------------------------
E         ERROR: Failed building wheel for psutil
```

The failure correlates with the change in base image (from buster to
bookworm) docker-library/python#822, which seems
to have been published at 2023-06-14T23:05Z
(https://hub.docker.com/layers/library/python/3.8/images/sha256-b904ee5365f53d19de5ff11c1ce96a616224a55306d55e3cf29a11e969a3a7e0?context=explore).

This change, that pins to the older image, seems to fix the problem.

This fixes
https://pantsbuild.slack.com/archives/C0D7TNJHL/p1686790197387729
  • Loading branch information
huonw authored and WorkerPants committed Jun 15, 2023
1 parent 5f2da32 commit b40f593
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,8 @@ def test_packaged_pex_environment(rule_runner: RuleRunner) -> None:
"""
docker_environment(
name="python_38",
image="python:3.8",
image="python:3.8-buster@sha256:bc4b9fb034a871b285bea5418cedfcaa9d2ab5590fb5fb6f0c42aaebb2e2c911",
platform="linux_x86_64",
python_bootstrap_search_path=["<PATH>"],
)
Expand Down Expand Up @@ -428,8 +429,8 @@ def test_packaged_pex_environment(rule_runner: RuleRunner) -> None:
rule_runner.write_digest(context.digest, path_prefix="contents")
with zipfile.ZipFile(os.path.join(rule_runner.build_root, "contents", pex_file), "r") as zf:
assert json.loads(zf.read("PEX-INFO"))["distributions"].keys() == {
"psutil-5.9.2-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"psutil-5.9.2-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"psutil-5.9.2-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
}


Expand Down

0 comments on commit b40f593

Please sign in to comment.