-
-
Notifications
You must be signed in to change notification settings - Fork 638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vcs_version fails when building pex binary in a docker environment #21178
Comments
I assume this is because the docker container doesn't have the local git state available? |
Yes, I believe that's right, from poking around the docker container yesterday and running the command myself. Is it possible to run the |
I think you're correct that this must always run locally, regardless of environment settings, so this is indeed a bug. |
It is possible to force the process to run locally, I will take a look at doing so. |
@kilogram can you create a simple repo that demonstrates the issue? Or alternatively, can you patch #21188 into the Pants repo, build Pants, and try it out on your use case? The simplest way to do this is to clone https://github.com/pantsbuild/pants, patch the change in, and run |
Works like a charm! I tested with this repro: https://github.com/kilogram/pants-21178-repro/blob/8fd6bb393f6c5690f8427dc62f8f344818531b16/pants.toml#L45 |
Fixed in #21188 |
Thanks for the report @kilogram , this will be in the next release. |
Thank you! |
Argh, I'm sorry, I missed something. The
I don't see an option to re-open this bug; should I create a new one? |
I've reopened. I will look at the repro. |
@kilogram what is an example of a working case? If I run |
Sorry about that. I've pushed a change to easily repro. At head in the repro directory:
Poking around the container, the produced As opposed to:
|
I can't pull the docker image, as it's hosted on some private repo |
@kilogram I will continue to look at this if you can make the example work without the private repo? |
Updated the repro repo, sorry about that! I am getting a different error now, even with |
Hmm, it cannot find your |
Yup. It works with the local_linux environment:
The only change is to revert the local changes, and it fails (with the docker environment):
|
I'll dig in, I see you've pushed the image source fix |
Hmm, that error happens even if I revert my change... |
Ah, because the process that finds |
FYI the docker image you provided ( |
Also, incidentally, while debugging this I fixed this: #21232 |
Pushed a fix to the repro, but still no joy; getting an empty version string:
|
Hmm, that may be a separate issue. Ignoring the |
Ugh, of course the python interpreter discovery also has to run locally... |
FWIW, |
Oh! In the docker environment, They both work as intended in the local environment. Keeping the sandboxes and unzipping the PEXes, the one produced by I hope you're not as lost as I am 😅 |
And all of that is with which set of changes? |
This is with your changes to |
Update that I am still trying to figure this one out. I have been sidetracked debugging some engine issue that is blocking the fix. |
It all works! Thank you! |
Awesome! This will be cherry-picked to 2.22.x, which will have an RC today and a stable release soon. |
When using environments we must ensure we run VCS-related processes in the local environment and not the inherited one, as a docker environment will not have access to Git state. In pantsbuild#21188 we made setuptools_scm itself run locally, but this was not sufficient: this change makes sure we also run the pex building and git binary discovery in the local environment. Fixes pantsbuild#21178
When using environments we must ensure we run VCS-related processes in the local environment and not the inherited one, as a docker environment will not have access to Git state. In #21188 we made setuptools_scm itself run locally, but this was not sufficient: this change makes sure we also run the pex building and git binary discovery in the local environment. Fixes #21178
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:I'm inferring from this that setuptools itself is not being run in the docker container.
The relevant portions of BUILD look like:
I observed that when the pex_binary's environment is "docker", the sandbox has broken
.cache
symlink:This of course succeeds when the pex_binary's environment is overriden to a local_environment:
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 19:49:19 +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.
The text was updated successfully, but these errors were encountered: