-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Inconsistency in the behaviour of the $PATH environment variable within Devfile. #23009
Comments
Not sure if this is related, but it's worth mentioning that tasks/commands executed in Che Code are run with @eye0fra we could verify whether this is causing the bug by adding a - exec:
commandLine: 'source /home/user/.bashrc && [ -d .m2 ] && mkdir -p .m2/ && cp -u ${MAVEN_HOME}/conf/settings.xml .m2/'
component: ssf-developer-image
workingDir: /home/user
id: m2-settings |
Adding |
I noticed that a command defined in the devfile, triggered during the postStart event, does not share the same environment variables as it would if launched normally inside the workspace. |
@eye0fra This is caused by a similar but different reason: postStart events are launched with For example: events:
postStart:
- load-environment
- my-command-that-needs-bash-env
- my-other-command
commands:
- id: load-environment
exec:
component: tools
commandLine: source ~/.bashrc
- id: my-command-that-needs-bash-env
exec:
component: tools
commandLine: <some-command>
- id: my-other-command
exec:
component: tools
commandLine: <some-other-command> You could also define the We could potentially take a similar approach to CheCode to resolve this in DevWorkspace Operator. However, I'm a bit hesitant to do this because it relies on the assumption that the tooling container uses bash (which is not always the case; some container images only provide However, if this workaround is not suitable and you would like to see this feature in DWO, I think this issue should be closed and a new Che issue should be opened (something like |
Yes, I’m aware of the workaround, but as you mentioned, the challenge arises when dealing with multiple shell environments, which is my case. It becomes necessary to restore the SHELL environment variable to avoid unexpected terminal issues. I agree that opening a dedicated issue to address this would be a good idea. |
@eye0fra In this case, this merits opening a new Che issue. I'm happy to do so for you, however, I'm not sure of the specific details of your problem when using multiple shell environments. Do you want me to open an issue and then you can provide those details in a comment or would you like to open the problem yourself? |
I will open a new one and put the details |
@eye0fra Sounds great, thank you :) |
Describe the bug
I've observed a potential inconsistency in the behaviour of the $PATH environment variable within Devfile.
When commands are executed using the command definition in the Devfile, they seem to have a different $PATH compared to commands launched in containers defined within the components section.
I'd like to confirm if this is the expected behaviour or if there might be a configuration issue.
Perhaps someone can clarify how the $PATH is managed in these different contexts.
$PATH env inside the task:
/home/tooling/.local/share/coursier/bin:/home/tooling/.nvm/versions/node/v18.20.3/bin:/home/tooling/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
$PATH env inside the component container image:
/checode/checode-linux-libc/ubi9/bin/remote-cli:/home/user/.local/bin:/home/user/bin:/home/tooling/.sdkman/candidates/maven/current/bin:/home/tooling/.sdkman/candidates/java/current/bin:/home/tooling/.sdkman/candidates/gradle/current/bin:/home/user/.nvm/versions/node/v18.20.3/bin:/home/tooling/.local/share/coursier/bin:/home/tooling/.nvm/versions/node/v18.20.3/bin:/home/tooling/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Che version
7.87@latest
Steps to reproduce
Parent devfile:
Child devfile:
Expected behavior
PATH on task must have the same value as the PATH env defined inside the image component.
Runtime
OpenShift
Screenshots
No response
Installation method
OperatorHub
Environment
other (please specify in additional context)
Eclipse Che Logs
No response
Additional context
OpenShift on-premise
The text was updated successfully, but these errors were encountered: