-
Notifications
You must be signed in to change notification settings - Fork 695
Remove python entrypoint declarations #1248
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
Conversation
…iner Python toolchain
/assign @smukherj1 |
/gcbrun |
Test py_image_complex_layer is failing, can you double check it please |
I'm seeing the following failure, and the cause is not obvious to me:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this change works as is and the failing e2e py_image tests demonstrate the issue. Basically the problem is, nowhere in the py_image
macro, app_layer
rule or the container_image
rule is the entrypoint extracted from the python toolchain and added to the generated image. With this change, the default entrypoint /usr/bin/python
is no longer set for the python images and as a result the built python image can no longer be run with bazel run
.
For example, without this change when I do bazel run //testdata:py_image_complex
I get the output
2322b07b1fca: Loading layer [==================================================>] 20.48kB/20.48kB
a7cfa517d927: Loading layer [==================================================>] 20.48kB/20.48kB
d020e73f9ddd: Loading layer [==================================================>] 51.2kB/51.2kB
cf24a96e44e7: Loading layer [==================================================>] 10.24kB/10.24kB
d9fbbb6dea0e: Loading layer [==================================================>] 10.24kB/10.24kB
833a80dfc7a5: Loading layer [==================================================>] 10.24kB/10.24kB
6ccee0e47b81: Loading layer [==================================================>] 10.24kB/10.24kB
41126e02259a: Loading layer [==================================================>] 10.24kB/10.24kB
6c808181fa57: Loading layer [==================================================>] 30.72kB/30.72kB
Loaded image ID: sha256:d1e762e7f34bb41281ac035114e9e83f59018198009c5ad40f3c45f614f8be88
Tagging d1e762e7f34bb41281ac035114e9e83f59018198009c5ad40f3c45f614f8be88 as bazel/testdata:py_image_complex
Calling from main module: through py_image_complex_library: Six version: 1.11.0
Calling from main module: through py_image_complex_library: Addict version: 2.1.2
after making this change I get
Loaded image ID: sha256:164cea6a3df2588b416bf8393f9a03897e9446eb49ee0f4e7af7ee104c2eebbe
Tagging 164cea6a3df2588b416bf8393f9a03897e9446eb49ee0f4e7af7ee104c2eebbe as bazel/testdata:py_image_complex
standard_init_linux.go:207: exec user process caused "no such file or directory"
However, fixing this is going to be tricky. py_image
and py_image3
are macros and thus can't extract info from the python toolchain. app_layer
is a rule and has access to toolchains but putting python specific logic in there might not be a good idea.
as per @smukherj1 comment, this PR might not be working as intended.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mmikitka The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Note that the py_binary is in the image entrypoint, and the error message Relevant output of
The top of
And, /usr/bin/env is not in the py_image_base layer. Nonetheless, this is somewhat beside the point, as we don't want to assume that the Python interpreter resolved by Essentially, we need the toolchain-specific Python interpreter to be the first command in the entrypoint. |
…preter; instead rely on PATH resolution.
/gcbrun |
Since we don't want language-specific logic (in this case Python) in the app_layer implementation, one solution is to remove the absolute path to Python, and rely on PATH resolution when calling python in the entrypoint. |
@mmikitka I don't think that will work as python resolution relies on using |
/assign @nlopezgi |
@nlopezgi Can we require users to explicitly declare the entrypoint in the event that Either way, an assumption must be made of the underlying base image i.e., is However, if you can propose a solution that does not require language-specific code in app_layer, I would gladly implement it. |
no, that would break too many existing use cases
For now, we will assume the latter, as that is the way it's currently implemented.
I can't think of any. Would adding the symlink to /usr/bin/python in the base container be an acceptable workaround for you? |
@nlopezgi I'll resort to explicitly setting the entrypoint or using a symlink as you suggested. Thanks for the conversation, and I think that we can close this issue |
See issue #1247