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

RHOAIENG-9707: chore(tests/containers): try to install the cowsay package to check the python venv is writable #873

Merged
merged 1 commit into from
Jan 31, 2025

Conversation

jiridanek
Copy link
Member

@jiridanek jiridanek commented Jan 29, 2025

https://issues.redhat.com/browse/RHOAIENG-9707

Description

  _________________________________________________
 /                                                 \
| Checks that the Python virtualenv in the image is |
|  writable.                                        |
 \                                                 /
  =================================================
                                                 \
                                                  \
                                                    ^__^
                                                    (oo)\_______
                                                    (__)\       )\/\
                                                        ||----w |
                                                        ||     ||

How Has This Been Tested?

Merge criteria:

  • The commits are squashed in a cohesive manner and have meaningful messages.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

@jstourac
Copy link
Member

LGTM, just wondering whether we should rather/also check the variant where python3 isn't used in the command. I mean, when user will simply execute pip install cowsay and then cowsay -t Hello. Technically these results should be identical as the very same python env should be used in both cases. 🤔

@jiridanek
Copy link
Member Author

We should rather/also check the variant where python3 isn't used in the command. I mean, when user will simply execute pip install cowsay and then cowsay -t Hello.

I don't know. @opendatahub-io/notebook-devs, thoughts? Thanks.

@daniellutz
Copy link
Contributor

from my understanding, the python3 -m pip install command would be more reliable, because you are already specifying the desired python version on it, and to me, technically, python3 -m pip install and pip install would be the same, so no issues regarding that, from my understanding.

this one looks good to me!

/lgtm

@jiridanek
Copy link
Member Author

because you are already specifying the desired python version on it

we're already in a python virtual environment when the image starts, and that sets up PATH to /opt/app-root/bin, where pip is present; so although in general case python3 -m pip is preferable, and /opt/app-root/bin/python3 -m pip is even better, in this case should be all the same.

the setting of python virtual env for auto activation is done through some magic around BASH_ENV variable.

    # The following echo adds the unset command for the variables set below to the \
    # venv activation script. This is inspired from scl_enable script and prevents \
    # the virtual environment to be activated multiple times and also every time \
    # the prompt is rendered. \
    echo "unset BASH_ENV PROMPT_COMMAND ENV" >> ${APP_ROOT}/bin/activate

# For RHEL/Centos 8+ scl_enable isn't sourced automatically in s2i-core
# so virtualenv needs to be activated this way
ENV BASH_ENV="${APP_ROOT}/bin/activate" \
    ENV="${APP_ROOT}/bin/activate" \
    PROMPT_COMMAND=". ${APP_ROOT}/bin/activate"

https://github.com/sclorg/s2i-python-container/blob/master/3.11/Dockerfile.rhel9#L84-L94

I was looking into it for

Copy link
Contributor

openshift-ci bot commented Jan 31, 2025

New changes are detected. LGTM label has been removed.

@openshift-ci openshift-ci bot added size/s and removed size/s labels Jan 31, 2025
@jiridanek
Copy link
Member Author

/override ci/prow/images
/approve

Copy link
Contributor

openshift-ci bot commented Jan 31, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jiridanek

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Contributor

openshift-ci bot commented Jan 31, 2025

@jiridanek: Overrode contexts on behalf of jiridanek: ci/prow/images

In response to this:

/override ci/prow/images
/approve

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@jiridanek
Copy link
Member Author

this is only a rebase, reapplying the lgtm myself

Copy link
Contributor

openshift-ci bot commented Jan 31, 2025

New changes are detected. LGTM label has been removed.

@jiridanek jiridanek added the lgtm label Jan 31, 2025
@openshift-ci openshift-ci bot added size/s and removed size/s labels Jan 31, 2025
@jiridanek
Copy link
Member Author

/override ci/prow/images

Copy link
Contributor

openshift-ci bot commented Jan 31, 2025

@jiridanek: /override requires failed status contexts, check run or a prowjob name to operate on.
The following unknown contexts/checkruns were given:

  • ci/prow/images

Only the following failed contexts/checkruns were expected:

  • build

If you are trying to override a checkrun that has a space in it, you must put a double quote on the context.

In response to this:

/override ci/prow/images

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci openshift-ci bot removed the size/s label Jan 31, 2025
@openshift-ci openshift-ci bot added the size/s label Jan 31, 2025
@jiridanek
Copy link
Member Author

/override ci/prow/images

Copy link
Contributor

openshift-ci bot commented Jan 31, 2025

@jiridanek: Overrode contexts on behalf of jiridanek: ci/prow/images

In response to this:

/override ci/prow/images

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-merge-bot openshift-merge-bot bot merged commit 5b7c52c into opendatahub-io:main Jan 31, 2025
7 checks passed
@jiridanek jiridanek deleted the jd_cowsay branch January 31, 2025 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants