Install tzdata and tzdata-legacy in gitlab-base
What does this MR do?
CNG 19.4 moved Debian images from bookworm to trixie in
!3052 (merged) . Debian
trixie split legacy IANA timezone names (for example Israel,
Europe/Kiev, US/Eastern, Asia/Calcutta) out of tzdata into a
separate tzdata-legacy package. That MR added tzdata-legacy to the
gitlab-rails image, but not to gitaly.
Gitaly's Go runtime resolves timezones with time.LoadLocation against
the system zoneinfo files. Without tzdata-legacy, it fails with
unknown time zone for any legacy name. GitLab Rails then surfaces
that Gitaly error as a false merge conflict when merging, updating a
merge ref, squashing, or creating a web commit, for any user whose
profile timezone is a legacy name.
This MR fixes it by installing tzdata and tzdata-legacy once in the
shared gitlab-base/Dockerfile, instead of per image:
- Adds
tzdataandtzdata-legacyto the shared runtime apt install list in the Debiangitlab-base/Dockerfile. - Removes the now-redundant
tzdatafromgitlab-rails/Dockerfile.erbin two places: thebuilder-basestage, and the final runtime stage wheretzdata tzdata-legacywere installed (also removes the stale comment there).
Every Debian final image in CNG chains back to gitlab-base (gitaly,
pages, shell, workhorse, zoekt, kas, mailroom, exporter, and the rails
family via gitlab-ruby). One install in base covers all of them,
including gitaly, without a separate change per image.
This mirrors gitlab-base/Dockerfile.ubi, which already installs
tzdata in the base image. UBI images are not changed here since RHEL
tzdata already ships the legacy names.
This MR supersedes
!3112 (closed) , which
fixed only the gitaly image. Moving the install into gitlab-base was
suggested by Jason Plum on that MR, so all Debian consumers are
covered in one place. A related GitLab Rails MR adds defense in depth
by translating legacy names to canonical names before calling Gitaly:
gitlab-org/gitlab!257897 (merged) .
This is a regression from the 19.4 trixie upgrade. A backport to the
19-4-stable branch will likely be needed.
Size impact
Installing tzdata and tzdata-legacy adds about 2 to 4 MB per
Debian image (tzdata is about 1.5 MB, tzdata-legacy about 0.5 MB
installed). This also removes the duplicate installs from
gitlab-rails, so the net increase is small.
Test plan
- Build the Debian
gitlab-base,gitaly, andgitlab-railsimages from this branch. - In the built gitaly and gitlab-rails images, confirm
/usr/share/zoneinfo/Israeland/usr/share/zoneinfo/Europe/Kievboth exist. - Confirm
tzdata-legacyis installed at the same version astzdata. - A Go program calling
time.LoadLocationforIsrael,Europe/Kiev,US/Eastern, andAsia/Calcuttasucceeds, where it previously failed withunknown time zone.
Related issues
- Closes #2427 (closed)
- GitLab issue: gitlab-org/gitlab#630996 (closed)
- Supersedes: !3112 (closed)
- Trixie upgrade that introduced the regression: !3052 (merged)
- GitLab Rails defense-in-depth fix: gitlab-org/gitlab!257897 (merged)
- Linux package Docker image already installs tzdata-legacy: gitlab-org/omnibus-gitlab!8759 (merged)
Checklist
Required
- Title and description are accurate and descriptive.
- MR targets
master. - MR has a green pipeline on GitLab.com (pipeline pending).
- Container size evaluated, see size impact note above.
- Test plan with conditions for success posted above (not yet run locally; relying on the MR pipeline image builds to validate).
Expected (please provide an explanation if not completing)
- FIPS pipeline run: not needed. This only changes Debian
Dockerfiles (
gitlab-baseandgitlab-rails). UBI/FIPS images useDockerfile.ubi, which is untouched. - Documentation updated: not needed. This is a package-only fix with no user-facing behavior or interface change.