pre-commit version: 2.13.0
sys.version:
3.6.9 (default, Jan 26 2021, 15:33:00)
[GCC 8.4.0]
sys.executable: /usr/bin/python3
os.name: posix
sys.platform: linux
An unexpected error has occurred: CalledProcessError: command: ('/usr/bin/docker', 'inspect', 'runner-dmrvfsu-project-35395-concurrent-0')
return code: 1
expected return code: 0
stdout:
[]
stderr:
Error: No such object: runner-dmrvfsu-project-35395-concurrent-0
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/pre_commit/error_handler.py", line 65, in error_handler
yield
File "/usr/local/lib/python3.6/dist-packages/pre_commit/main.py", line 385, in main
return run(args.config, store, args)
File "/usr/local/lib/python3.6/dist-packages/pre_commit/commands/run.py", line 410, in run
return _run_hooks(config, hooks, skips, args, environ)
File "/usr/local/lib/python3.6/dist-packages/pre_commit/commands/run.py", line 288, in _run_hooks
verbose=args.verbose, use_color=args.color,
File "/usr/local/lib/python3.6/dist-packages/pre_commit/commands/run.py", line 194, in _run_single_hook
retcode, out = language.run_hook(hook, filenames, use_color)
File "/usr/local/lib/python3.6/dist-packages/pre_commit/languages/docker_image.py", line 19, in run_hook
cmd = docker_cmd() + hook.cmd
File "/usr/local/lib/python3.6/dist-packages/pre_commit/languages/docker.py", line 107, in docker_cmd
'-v', f'{_get_docker_path(os.getcwd())}:/src:rw,Z',
File "/usr/local/lib/python3.6/dist-packages/pre_commit/languages/docker.py", line 34, in _get_docker_path
_, out, _ = cmd_output_b('docker', 'inspect', hostname)
File "/usr/local/lib/python3.6/dist-packages/pre_commit/util.py", line 154, in cmd_output_b
raise CalledProcessError(returncode, cmd, retcode, stdout_b, stderr_b)
pre_commit.util.CalledProcessError: command: ('/usr/bin/docker', 'inspect', 'runner-dmrvfsu-project-35395-concurrent-0')
return code: 1
expected return code: 0
stdout:
[]
stderr:
Error: No such object: runner-dmrvfsu-project-35395-concurrent-0
When trying to run pre commits with
docker_imagelanguage via GitLabs Docker in Docker approach the docker inspect fails, and so pre-commit throws an error when trying to get the mount path.The code for this already has a fall back of "return path" but doesn't handle the docker command failing.
Could the code for this be modified to handle the docker inspect failing?
More details of docker in docker are here
Full logs of the failure:
version information
error information