https://pantsbuild.org/ logo
#general
Title
# general
a

ambitious-actor-36781

08/27/2021, 7:15 AM
Hm, unforseen problem with using pants to build docker images.... You need a host with both pants and python... Which is fine in some cases (i.e. a developers machine), but kinda a pain if you're running in a CI system that does all the build steps in docker (subtext: gitlab).
h

happy-kitchen-89482

08/27/2021, 2:39 PM
Hi! Can you elaborate? Does the docker image not have Python preinstalled?
a

ambitious-actor-36781

08/29/2021, 3:55 AM
So... • Gitlab CI runs everything in docker images. • the
python
image has
pythonX.Y
installed... but not
docker
• the
docker:latest
image does not have python installed. which means, (for any standard prebuilt docker image) you can either • run pants • run docker But not both. (note: you can install python in the docker image easily, but gitlab-ci is garbage and you can't cache it) Now, I'm using my janky barebones "build docker images" pants plugin, which runs docker via the command line. So /in theory/ this might not be an issue if I changed it to use docker-via-python
for that matter,
./pants
does not seem to be a fan of the docker images
Copy code
╰─➤  docker run --rm -it --entrypoint="" -v $(pwd):/src --workdir=/src docker:latest sh -c 'apk add python3 bash curl py3-pip; ./pants'
fetch <https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz>
fetch <https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz>
(1/38) Installing readline (8.1.0-r0)
(2/38) Installing bash (5.1.0-r0)
Executing bash-5.1.0-r0.post-install
(3/38) Installing brotli-libs (1.0.9-r3)
(4/38) Installing nghttp2-libs (1.42.0-r1)
(5/38) Installing libcurl (7.78.0-r0)
(6/38) Installing curl (7.78.0-r0)
(7/38) Installing libbz2 (1.0.8-r1)
(8/38) Installing expat (2.2.10-r1)
(9/38) Installing libffi (3.3-r2)
(10/38) Installing gdbm (1.19-r0)
(11/38) Installing xz-libs (5.2.5-r0)
(12/38) Installing sqlite-libs (3.34.1-r0)
(13/38) Installing python3 (3.8.10-r0)
(14/38) Installing py3-appdirs (1.4.4-r1)
(15/38) Installing py3-ordered-set (4.0.2-r0)
(16/38) Installing py3-parsing (2.4.7-r1)
(17/38) Installing py3-six (1.15.0-r0)
(18/38) Installing py3-packaging (20.9-r0)
(19/38) Installing py3-setuptools (51.3.3-r0)
(20/38) Installing py3-chardet (4.0.0-r0)
(21/38) Installing py3-idna (3.1-r0)
(22/38) Installing py3-urllib3 (1.26.2-r1)
(23/38) Installing py3-requests (2.25.1-r1)
(24/38) Installing py3-msgpack (1.0.2-r0)
(25/38) Installing py3-lockfile (0.12.2-r3)
(26/38) Installing py3-cachecontrol (0.12.6-r0)
(27/38) Installing py3-colorama (0.4.4-r0)
(28/38) Installing py3-contextlib2 (0.6.0-r0)
(29/38) Installing py3-distlib (0.3.1-r1)
(30/38) Installing py3-distro (1.5.0-r1)
(31/38) Installing py3-webencodings (0.5.1-r3)
(32/38) Installing py3-html5lib (1.1-r0)
(33/38) Installing py3-pytoml (0.1.21-r0)
(34/38) Installing py3-pep517 (0.9.1-r0)
(35/38) Installing py3-progress (1.5-r0)
(36/38) Installing py3-retrying (1.3.3-r0)
(37/38) Installing py3-toml (0.10.2-r0)
(38/38) Installing py3-pip (20.3.4-r0)
Executing busybox-1.32.1-r6.trigger
OK: 82 MiB in 59 packages
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   122  100   122    0     0   1643      0 --:--:-- --:--:-- --:--:--  1648
100   281  100   281    0     0    655      0 --:--:-- --:--:-- --:--:--   655
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 3626k  100 3626k    0     0  3498k      0  0:00:01  0:00:01 --:--:-- 9505k
Using base prefix '/usr'
New python executable in /root/.cache/pants/setup/bootstrap-Linux-x86_64/pants.bMGlNF/install/bin/python3.8
Also creating executable in /root/.cache/pants/setup/bootstrap-Linux-x86_64/pants.bMGlNF/install/bin/python
Installing setuptools, pip, wheel...
done.
Collecting pip
  Downloading <https://files.pythonhosted.org/packages/ca/31/b88ef447d595963c01060998cb329251648acf4a067721b0452c45527eb8/pip-21.2.4-py3-none-any.whl> (1.6MB)
    100% |████████████████████████████████| 1.6MB 9.9MB/s 
Installing collected packages: pip
  Found existing installation: pip 19.0.3
    Uninstalling pip-19.0.3:
      Successfully uninstalled pip-19.0.3
Successfully installed pip-21.2.4
ERROR: Could not find a version that satisfies the requirement pantsbuild.pants==2.6.0 (from versions: 0.0.17, 0.0.18, 0.0.20, 0.0.21, 0.0.22, 0.0.23, 0.0.24, 0.0.25, 0.0.26, 0.0.27, 0.0.28, 0.0.29, 0.0.30, 0.0.31, 0.0.32, 0.0.33, 0.0.34, 0.0.35, 0.0.36, 0.0.37, 0.0.38, 0.0.39, 0.0.40, 0.0.41, 0.0.42, 0.0.43, 0.0.44, 0.0.45, 0.0.46, 0.0.47, 0.0.48, 0.0.49, 0.0.50, 0.0.51, 0.0.52, 0.0.53, 0.0.54, 0.0.55, 0.0.56, 0.0.57, 0.0.58, 0.0.59, 0.0.60, 0.0.61, 0.0.62, 0.0.63, 0.0.64, 0.0.65, 0.0.66, 0.0.67, 0.0.68, 0.0.69, 0.0.70, 0.0.71, 0.0.72, 0.0.73, 0.0.74, 0.0.75, 0.0.76, 0.0.77, 0.0.79, 0.0.80, 0.0.81, 0.0.82, 1.0.0, 1.0.1, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.4.0, 1.5.0, 1.6.0, 1.7.0)
ERROR: No matching distribution found for pantsbuild.pants==2.6.0
./pants: line 282: /root/.cache/pants/setup/bootstrap-Linux-x86_64/2.6.0_py38/bin/python: No such file or directory
Ohhhh
alpine linux
h

happy-kitchen-89482

08/30/2021, 11:32 AM
Ah yes, alpine is trouble.