Files sourced on pipeline shell step

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Files sourced on pipeline shell step

Kamil Dzierżanowski
Hello,

I'm trying to determine, which (if any) files are sourced by the shell, in which commands specified in "sh" pipeline step are executed. I need to make sure the NVM (Node Version Manager) is sourced everytime this step is used.
I tried numerous dot-files for the user the Jenkins agent is using, as well as the /etc/profile, but none works. I'll be grateful for any hints or for pointing me to an existing answer (I failed to find any).

Kamil

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/06048e11-c62e-4123-a67f-216d0e01d2b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Files sourced on pipeline shell step

NeilF


On Wednesday, 9 January 2019 09:19:25 UTC, Kamil Dzierżanowski wrote:
Hello,

I'm trying to determine, which (if any) files are sourced by the shell, in which commands specified in "sh" pipeline step are executed. I need to make sure the NVM (Node Version Manager) is sourced everytime this step is used.
I tried numerous dot-files for the user the Jenkins agent is using, as well as the /etc/profile, but none works. I'll be grateful for any hints or for pointing me to an existing answer (I failed to find any).

Kamil

Did you try the nvm plugin ? https://wiki.jenkins.io/display/JENKINS/Nvm+Wrapper+Plugin

 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/3abb354f-ac77-4b2a-9dee-fb5be80838bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Files sourced on pipeline shell step

Martin Baillie
In reply to this post by Kamil Dzierżanowski
 I'm experiencing a similar issue, did you find a solution?

On Wednesday, 9 January 2019 09:19:25 UTC, Kamil Dzierżanowski wrote:
Hello,

I'm trying to determine, which (if any) files are sourced by the shell, in which commands specified in "sh" pipeline step are executed. I need to make sure the NVM (Node Version Manager) is sourced everytime this step is used.
I tried numerous dot-files for the user the Jenkins agent is using, as well as the /etc/profile, but none works. I'll be grateful for any hints or for pointing me to an existing answer (I failed to find any).

Kamil

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/047cc8df-748e-4e4d-a119-bca7bf828dcbo%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Files sourced on pipeline shell step

Kamil Dzierżanowski-2
It looks like the "sh" step uses the same shell session that the Jenkins agent does when connecting a node to master. Therefore, any default shell configuration is determined in node settings, and changing it, or any of the dot files, requires reconnecting the node to reload them.

I would say it is a best practice to use a Jenkins Shared Library and define a custom step, which will use the "sh" step to run a specified command in a new "bash" login session. That way you can ensure the proper dot files, NVM etc. are always sourced fresh.

On Monday, June 15, 2020 at 9:18:58 PM UTC+2, Martin Baillie wrote:
 I'm experiencing a similar issue, did you find a solution?

On Wednesday, 9 January 2019 09:19:25 UTC, Kamil Dzierżanowski wrote:
Hello,

I'm trying to determine, which (if any) files are sourced by the shell, in which commands specified in "sh" pipeline step are executed. I need to make sure the NVM (Node Version Manager) is sourced everytime this step is used.
I tried numerous dot-files for the user the Jenkins agent is using, as well as the /etc/profile, but none works. I'll be grateful for any hints or for pointing me to an existing answer (I failed to find any).

Kamil

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/53979b0c-41e1-43c1-a50b-450823380f45o%40googlegroups.com.