Jenkins does not use system's locales
Solution:
This happens because the Jenkins master connects to the slave machine via non-interactive
shell, so /etc/profile
is not executed, and also /etc/default/locale
does not have any effect.
non-interactive
shells are usually using ~/.bashrc
.
Nearly all details about this topic can be found on askubuntu:
https://askubuntu.com/questions/247738/why-is-etc-profile-not-invoked-for-non-login-shells
adding to ~/.bashrc
:
export LANG=en_US.UTF-8
export LANGUAGE=en_US:en
did it for me.
This 'slave problem' is also discussed here:
https://groups.google.com/forum/#!topic/jenkinsci-users/hscDs4pKIoU
https://groups.google.com/forum/#!topic/jenkinsci-users/g0fNnDltqeM
Kind regards, whosit
Related videos on Youtube
![whosit](https://i.stack.imgur.com/N1BPo.jpg?s=256&g=1)
whosit
Updated on September 18, 2022Comments
-
whosit almost 2 years
I got a interesting behavior in Jenkins.
Jenkins' shell does not use my systems locales.Jenkins runs as user
jenkins
on my system.Logged in as
jenkins
via SSH:locale
displayed:LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
etc...env
showsLANG
andLANGUAGE
variables:LANG=en_US.UTF-8
LANGUAGE=en_US:enid
shows the ID of user:uid=1008(jenkins) gid=...
Entered above commands to a jenkins job shell:
locale
displayed:LANG=
LANGUAGE=
LC_CTYPE="POSIX"
etc...env
does not showLANG
andLANGUAGE
variablesid
shows the ID of user (as expected):uid=1008(jenkins) gid=...
the files:
/etc/profile
contains:export LANG=en_US.UTF-8
export LANGUAGE=en_US:en/etc/default/locale
contains:export LANG=en_US.UTF-8
export LANGUAGE=en_US:enstartup script
/etc/init.d/jenkins
should export system's locales:# load environments
if [ -r /etc/default/locale ]; then
. /etc/default/locale
export LANG LANGUAGE
elif [ -r /etc/environment ]; then
. /etc/environment
export LANG LANGUAGE
fi
Of course I rebooted after modifying the locales ;)
Apache also uses the system's locales
My system is an Ubuntu 14.04 installation.
Did I miss to check something else?
Thank you for reading!
I hope somebody can help :)-
YoloTats.com over 9 yearsJenkins seems to reset all environment variables in build shells. Check the project settings. There is also an env-inject plugin.
-
jasonwryan over 9 yearsYour solution should be an answer, not an edit to your question...
-