GDK-in-a-box: Add LOCALE env vars to GDK-in-a-box container image
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you receive complimentary access to GitLab Duo.
What does this merge request do and why?
This merge request fixes locale encoding issues in the GDK-in-a-box Docker container that cause failures when processing UTF-8 characters (emojis, international characters) in various tools like Danger, Git, and Ruby applications, see #2035 (comment 2785270169) .
The container was generating UTF-8 locales but not setting them as the default, causing processes to fall back to the ASCII-only POSIX
locale. This resulted in encoding errors when tools encountered non-ASCII characters, particularly in commit messages and JSON parsing.
How to set up and validate locally
-
Build the updated Docker image with the locale fix:
docker build -t gdk-in-a-box:locale-fix -f support/gdk-in-a-box/Dockerfile .
-
Run a container from the new image:
docker run -it gdk-in-a-box:locale-fix /bin/bash
-
Verify the locale is correctly set to UTF-8:
locale # Should show LANG=en_US.UTF-8 and LC_ALL=en_US.UTF-8 locale charmap # Should show UTF-8, not ANSI_X3.4-1968 or ASCII
-
Test UTF-8 handling with a practical example:
# Create a file with emoji echo "Test 🚀" > test.txt cat test.txt # Test with Ruby ruby -e "puts '🤖 UTF-8 works!'" # Test with Git commit containing emoji git init test-repo && cd test-repo echo "test" > file.txt git add file.txt git commit -m "Initial commit 🎉"
-
Run Danger to ensure it can parse emoji without errors:
bundle exec danger dry_run # Should complete without "Invalid byte sequence" errors
Impacted categories
The following categories relate to this merge request:
-
gdk-reliability - e.g. When a GDK action fails to complete. -
gdk-usability - e.g. Improvements or suggestions around how the GDK functions. -
gdk-performance - e.g. When a GDK action is slow or times out.
Merge request checklist
-
This MR references an issue describing the change. -
This change is backward compatible. If not, please include steps to communicate to our users. -
Tests added for new functionality. If not, please raise an issue to follow-up. -
Documentation added/updated, if needed. -
Announcement added, if change is notable. -
gdk doctor
test added, if needed.
Related to #2035