Hello, In our cicd pipeline we’re trying to genera...
# general
p
Hello, In our cicd pipeline we’re trying to generate the coverage report and receive the following
Copy code
[2023-06-28T16:41:59.676Z] 16:41:59.32 [INFO] Starting: Building coverage_py.pex from coverage-py_default.lock
[2023-06-28T16:42:00.599Z] 16:42:00.32 [INFO] Completed: Building coverage_py.pex from coverage-py_default.lock
[2023-06-28T16:42:00.599Z] 16:42:00.32 [ERROR] 1 Exception encountered:
[2023-06-28T16:42:00.600Z] 
[2023-06-28T16:42:00.600Z] Engine traceback:
[2023-06-28T16:42:00.600Z]   in `test` goal
[2023-06-28T16:42:00.600Z]   in Generate Pytest coverage reports
[2023-06-28T16:42:00.600Z] 
[2023-06-28T16:42:00.600Z] ProcessExecutionFailure: Process 'Building coverage_py.pex from coverage-py_default.lock' failed with exit code 1.
[2023-06-28T16:42:00.600Z] stdout:
[2023-06-28T16:42:00.600Z] 
[2023-06-28T16:42:00.600Z] stderr:
[2023-06-28T16:42:00.600Z] There were 2 errors downloading required artifacts:
[2023-06-28T16:42:00.600Z] 1. coverage 6.5 from <https://files.pythonhosted.org/packages/3c/7d/d5211ea782b193ab8064b06dc0cc042cf1a4ca9c93a530071459172c550f/coverage-6.5.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl>
[2023-06-28T16:42:00.600Z]     ModuleNotFoundError: No module named 'distutils.util'
[2023-06-28T16:42:00.600Z] 2. tomli 2.0.1 from <https://files.pythonhosted.org/packages/97/75/10a9ebee3fd790d20926a90a2547f0bf78f371b2f13aa822c759680ca7b9/tomli-2.0.1-py3-none-any.whl>
[2023-06-28T16:42:00.600Z]     ModuleNotFoundError: No module named 'distutils.util'
Is this a dependency issue we’re not covering in our jenkins-agent or something we need to install manually?
f
Is your CI/CD running on debian or a debian-derived distro like ubuntu? If so, they package distutils separately from python even though distutils is part of the stdlib (<https://docs.python.org/3/whatsnew/3.10.html#distutils-deprecated%7Cat least for python < 3.12>). Not sure how Pants deals with this though. You could make sure to
apt install python3-distutils
or even use something like pyenv or asdf or getting standalone python distros (this is what I always did on Ubuntu)
What is your CI environment? (Jenkins? GHA? something else?) And what OS are you using?
p
Jenkins, our devops team is currently in charge of our jenkins-agent Dockerfile so I believe they just moved us from debian9 to ubuntu 22.04
f
Probably easiest fix in that case would be to get them to add python3-distutils to the packages that get installed in your jenkins agent Dockerfile
Like I said, I generally prefer standalone Python builds for this stuff, but if your devops team is managing infra like that, you'd need to consult with them on the implications of using those. I don't know enough about your deployment story to know what your needs are there, but as a general rule it is nice to test against a Python that is the same as or close to the target Python(s) your application will be run with in prod deployments. So if you run ubuntu 22.04's python in prod, then that's probably what you should be using in test.
p
Got it, thanks for the advice Josh!