[ci] fix locale-setting in jobs running in ubuntu container #5643
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Today, the Linux CI jobs on Azure DevOps run in a container using the
ubuntu:22.04
image. Since that image is just a minimal operating system distribution, running LightGBM's CI in it requires a lot of extra configuration.Here's where much of that happens:
LightGBM/.ci/setup.sh
Line 26 in a174893
I noticed while working on #5638 that one piece of that has been silently failing for a while (unsure how long).
There are a few problems with this bit of configuration that tries to change the locale inside the container to
en_US.UTF-8
:LightGBM/.ci/setup.sh
Lines 58 to 61 in a174893
Setting
LC_ALL
environment variable to a locale that doesn't exist yet (i.e. hasn't been downloaded or generated withlocale-gen
) isn't possible. That's why this warning shows up in theLinux_latest
logs(recent build on master)
Setting environment variables inside a process only affects that process and it's sub-processes...so those variables won't be used by
test.sh
, since it runs in a separate process not as a sub-process ofsetup.sh
LightGBM/.vsts-ci.yml
Lines 142 to 145 in a174893
I noticed this because once I started trying to get
.ci/test_r_package.sh
to run in anubuntu:22.04
container, the R unit test about handling of non-ASCII feature names was failing, and R was reporting that it had fallen back to the default character set for the image (ASCII
, the "POSIX" locale).This PR proposes the following changes:
locales-all
instead of generating a specific locale withlocale-gen
LC_ALL
again intest.sh
IN_UBUNTU_LATEST_CONTAINER
toIN_UBUNTU_BASE_CONTAINER
ubuntu:18.04
instead ofubuntu:22.04
container, but it can re-use all of the setup stuff.ubuntu:{something}
container