Skip to content
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

cocci: Fix Python path for coccilib #24430

Merged
merged 1 commit into from Mar 17, 2023

Conversation

qmonnet
Copy link
Member

@qmonnet qmonnet commented Mar 17, 2023

Trying to run the coccinelle checks locally (with the coccicheck image from DockerHub, or by rebuilding it locally) fails with the current error:

Python error: No module named 'coccilib'

It so happens that it has also been failing silently in the CI for a while! Logging in to the container, we can see:

bash-5.1$ python3
Python 3.10.4 (main, Apr 30 2022, 16:49:16) [GCC 11.2.1 20220219] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.path)
['', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/usr/lib/python3.10/site-packages']

bash-5.1$ find /usr -name 'coccilib'
/usr/local/lib/coccinelle/python/coccilib

This can be trivially addressed by adding the relevant module path to the $PYTHONPATH environment variable in the Dockerfile.

The coccinelle checks used to work, but now fail on multiple branches. The root cause for the issue is unknown at this time.

This commit was split off of #24392, so we can merge the Dockerfile change, then generate a new image from the repo, and at last fix the script and coccinelle reports and update the image references (see initial PR). See also that PR as proof that setting $PYTHONPATH does fix the issue.

Trying to run the coccinelle checks locally (with the coccicheck image
from DockerHub, or by rebuilding it locally) fails with the current
error:

    Python error: No module named 'coccilib'

It so happens that it has also been failing silently in the CI for a
while! Logging in to the container, we can see:

    bash-5.1$ python3
    Python 3.10.4 (main, Apr 30 2022, 16:49:16) [GCC 11.2.1 20220219] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import sys
    >>> print(sys.path)
    ['', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/usr/lib/python3.10/site-packages']

    bash-5.1$ find /usr -name 'coccilib'
    /usr/local/lib/coccinelle/python/coccilib

This can be trivially addressed by adding the relevant module path to
the $PYTHONPATH environment variable in the Dockerfile.

The coccinelle checks used to work, but now fail on multiple branches.
The root cause for the issue is unknown at this time.

Signed-off-by: Quentin Monnet <quentin@isovalent.com>
@qmonnet qmonnet added kind/bug/CI This is a bug in the testing code. area/CI Continuous Integration testing issue or flake sig/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages. release-note/ci This PR makes changes to the CI. labels Mar 17, 2023
@qmonnet qmonnet requested a review from a team as a code owner March 17, 2023 14:08
@qmonnet qmonnet requested a review from ldelossa March 17, 2023 14:08
@aanm aanm merged commit 0dad157 into cilium:master Mar 17, 2023
41 checks passed
@qmonnet qmonnet deleted the pr/coccicheck-dockerfile-fix branch March 17, 2023 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/CI Continuous Integration testing issue or flake kind/bug/CI This is a bug in the testing code. release-note/ci This PR makes changes to the CI. sig/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants