pre-commit/tests/languages
Matthew Hughes 466f6c4a39 Fix permission errors for mounts in rootless docker
By running containers in a rootless docker context as root. This is
because user and group IDs are remapped in the user namespaces uses by
rootless docker, and it's unlikely that the current user ID will map to
the same ID under this remap (see docs[1] for some more details).
Specifically, it means ownership of mounted volumes will not be for the
current user and trying to write can result in permission errors.

This change borrows heavily from an existing PR[2].

The output format of `docker system info` I don't think is
documented/guaranteed anywhere, but it should corresponding to the
format of a `/info` API request to Docker[3]

The added test _hopes_ to avoid regressions in this behaviour, but since
tests aren't run in a rootless docker context on the PR checks (and I
couldn't find an easy way to make it the case) there's still a risk of
regressions sneaking in.

Link: https://docs.docker.com/engine/security/rootless/ [1]
Link: https://github.com/pre-commit/pre-commit/pull/1484/ [2]
Link: https://docs.docker.com/reference/api/engine/version/v1.48/#tag/System/operation/SystemAuth [3]
Co-authored-by: Kurt von Laven <Kurt-von-Laven@users.noreply.github.com>
Co-authored-by: Fabrice Flore-Thébault <ffloreth@redhat.com>
2025-05-23 17:01:10 -04:00
..
__init__.py OMG we're running a hook 2014-03-13 22:12:33 -07:00
conda_test.py test conda language directly 2023-01-17 13:05:49 -05:00
coursier_test.py coursier: additional_dependencies support 2023-01-17 09:59:04 -05:00
dart_test.py test dart directly 2023-01-17 18:44:14 -05:00
docker_image_test.py fix docker_image test when ubuntu:22.04 image is not pre-pulled 2024-12-28 15:45:05 -05:00
docker_test.py Fix permission errors for mounts in rootless docker 2025-05-23 17:01:10 -04:00
dotnet_test.py update .net tests to use .net 8 2024-12-28 15:50:58 -05:00
fail_test.py test fail language inline 2023-02-13 17:03:59 -06:00
golang_test.py disable automatic toolchain switching for golang hooks 2024-11-25 18:47:18 -05:00
haskell_test.py Add haskell language support to pre-commit. 2023-07-22 16:28:48 -04:00
julia_test.py Add support for julia hooks 2024-11-25 18:31:25 -05:00
lua_test.py test lua directly 2023-01-17 23:43:31 -05:00
node_test.py Bump Node.js version to 18.14.0 and Go to 1.21.1 2023-09-25 17:02:13 +08:00
perl_test.py test perl language directly 2023-01-17 17:34:04 -05:00
pygrep_test.py test pygrep inline 2023-02-18 17:54:44 -05:00
python_test.py adjust python default_language_version to prefer versioned exe 2025-03-18 14:55:24 -04:00
r_test.py fix: ensure env patch is applied for vanilla emulation 2025-01-20 13:13:36 -05:00
ruby_test.py use a simpler gem for testing additional_dependencies 2024-04-29 21:28:16 -04:00
rust_test.py determine rust default language version independent of rust-toolchain.toml 2024-05-10 17:06:29 -04:00
script_test.py test things more directly to improve coverage 2023-02-20 18:18:08 -05:00
swift_test.py test swift language directly 2023-01-17 13:51:06 -05:00
system_test.py test things more directly to improve coverage 2023-02-20 18:18:08 -05:00