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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/53979b0c-41e1-43c1-a50b-450823380f45o%40googlegroups.com.

Reply via email to