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
shows LANG
and LANGUAGE
variables:
LANG=en_US.UTF-8
LANGUAGE=en_US:en
id
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 show LANG
and LANGUAGE
variables
id
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:en
startup 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 🙂
Best Answer
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
: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