Hardened GitLab toolbox
container image for GitLab backup jobs (gitlab-backup uploads to object
storage via the bundled s3cmd).
Default base image: registry.jihulab.com/gitlab-cn/build/cng-images/gitlab-toolbox-jh:v16.4.7
(JiHu / 极狐 GitLab). Override at build time with --build-arg BASE_IMAGE=...,
e.g. the official EE image registry.gitlab.com/gitlab-org/build/cng/gitlab-toolbox-ee:v16.4.7.
s3cmd 2.3.0 (bundled in the toolbox image) verifies uploads by comparing the
ETag returned by the object store with the locally computed MD5 hexdigest,
case-sensitively (S3/S3.py, send_file()):
if ('-' not in md5_from_s3) and (md5_from_s3 != md5_hash.hexdigest()) and ...Object stores that return UPPERCASE hex etags make every upload fail with
MD5 Sums don't match!, aborting gitlab-backup. The image build patches
that single line in place to compare md5_from_s3.lower() — case-insensitive,
still skipping multipart (-) ETags and KMS-encrypted objects.
- Future base-image bumps keep all upstream s3cmd fixes; only this one line changes semantics.
- A silent no-op is impossible:
grepfails the build if upstream ever rewrites the target line, andpy_compilefails it if the patch corrupts the file. - The
S3package path is resolved at build time viaS3.__path__[0], so a python version bump in the base image needs no Dockerfile edit. - The patch runs as
root(site-packages is root-owned); the image default usergit:gitis restored afterwards.
- Bump
BASE_IMAGEin theDockerfile. - Build. If the bundled s3cmd changed the target line, the build fails at
the
grepguard — re-evaluate the patch against the new s3cmd source. - Tag
v*to publish a release image (or merge tomainforcanary).
Verified base images (S3.py extracted from the published image layer and byte-compared against the official s3cmd 2.3.0 sdist on PyPI):
| Base image | python | bundled s3cmd | S3.py == PyPI sdist | target line |
|---|---|---|---|---|
gitlab-toolbox-jh:v16.1.8 |
3.8.16 | 2.3.0 | ✅ | unique, no .lower() |
gitlab-toolbox-jh:v16.2.11 |
3.9.17 | 2.3.0 | ✅ | unique, no .lower() |
gitlab-toolbox-jh:v16.3.9 |
3.9.17 | 2.3.0 | ✅ | unique, no .lower() |
gitlab-toolbox-jh:v16.4.7 |
3.9.18 | 2.3.0 | ✅ | unique, no .lower() |
Images are published to ghcr.io/aiopsclub/gitlab-toolbox-ee on pushes to
main (canary tag) and v* tags (release) via GitHub Actions.