<#21178 vcs_version fails when building pex binary...
# github-notifications
c
#21178 vcs_version fails when building pex binary in a docker environment Issue created by kilogram Describe the bug vcs_version targets fail to build when pointed at a docker_environment:
('ERROR: no version found for', Namespace(root='/u/kilogram/src/loose-cannon', config='pyproject.synthetic.toml', strip_dev=False, command=None))
The
__run.sh
looks the same regardless of the environment: #!/usr/bin/env bash # This command line should execute the same process as pants did internally. cd /tmp/pants-sandbox-AGNZdd env -i ./setuptools_scm.pex_pex_shim.sh --root /u/kilogram/src/loose-cannon --config pyproject.synthetic.toml I'm inferring from this that setuptools itself is not being run in the docker container. The relevant portions of BUILD look like:
Copy code
__defaults__({
  pex_binary: dict(environment="docker"),
  docker_image: dict(build_platform=["linux/amd64"]),
})

vcs_version(
    name = "_version",
    generate_to="libs/_version.py",
    template='vcs_version = "{version}"',
)

docker_environment(name="docker", platform="linux_x86_64", ...)
pex_binary(..., environment="docker")
I observed that when the pex_binary's environment is "docker", the sandbox has broken
.cache
symlink:
Copy code
$ ls -al /tmp/pants-sandbox-AGNZdd/.cache/pex_root
lrwxrwxrwx 1 kilogram kilogram 28 Jul 16 16:35 /tmp/pants-sandbox-AGNZdd/.cache/pex_root -> /pants-named-caches/pex_root
This of course succeeds when the pex_binary's environment is overriden to a local_environment:
Copy code
$ ls -al /tmp/pants-sandbox-7uPeuH/.cache/pex_root
lrwxrwxrwx 1 kilogram kilogram 46 Jul 16 16:39 /tmp/pants-sandbox-7uPeuH/.cache/pex_root -> /u/kilogram/.cache/pants/named_caches/pex_root
Pants version Which version of Pants are you using? 2.22.0a0 OS Are you encountering the bug on MacOS, Linux, or both? Linux edi 6.9.6-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 21 Jun 2024 194919 +0000 x86_64 GNU/Linux ldd (GNU libc) 2.39 cp311-cp311-manylinux_2_39_x86_64 Additional info Add any other information about the problem here, such as attachments or links to gists, if relevant. pantsbuild/pants