предварительная фиксация не выполняется в контейнере docker

#pre-commit.com

#pre-commit.com

Вопрос:

Я попытался установить pre-commit==1.20.0 в нашей среде разработки с докеризацией, просто чтобы позволить нам запускать вручную pre-commit run --all-files . Однако происходит сбой с ошибкой, которую я не могу расшифровать. Я предполагаю, что дополнительный индекс, который является частью наших контейнеров docker, отключает предварительную фиксацию, но я не уверен.

Вот содержимое /etc/pip.conf :

 [global]
extra-index-url=https://pkgs.dev.azure.com/COMPANY/PROJECT/_packaging/mi_r00397_shared/pypi/simple/
  

Я знаю, что это работает, потому что обычно нам приходится вызывать pip install package --extra-index-url https://pkgs.dev.azure.com/COMPANY/PROJECT/_packaging/mi_r00397_shared/pypi/simple/ для установки пакетов, тогда как pip.conf это успешно реализовано и pip install package достаточно.

Ошибка, с которой я сталкиваюсь pre-commit run --all-files , заключается в следующем:

 pre-commit run --all-files
[INFO] Installing environment for https://github.com/ambv/black.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: Command: ('/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/bin/python', '/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/bin/pip', 'install', '.')
Return code: 1
Expected return code: 0
Output:
    Looking in indexes: https://pypi.org/simple, https://pkgs.dev.azure.com/COMPANY/PROJECT/_packaging/mi_r00397_shared/pypi/simple/
    Processing /home/thomas/.cache/pre-commit/repoa3dsqwwo
      Installing build dependencies: started
      Installing build dependencies: finished with status 'error'
    User for pkgs.dev.azure.com:
Errors:
      ERROR: Command errored out with exit status 2:
       command: /home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/bin/python /home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-che1xbcz/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple --extra-index-url https://pkgs.dev.azure.com/COMPANY/PROJECT/_packaging/mi_r00397_shared/pypi/simple/ -- 'setuptools>=41.0' setuptools-scm wheel
           cwd: None
      Complete output (51 lines):
      Looking in indexes: https://pypi.org/simple, https://pkgs.dev.azure.com/COMPANY/PROJECT/_packaging/mi_r00397_shared/pypi/simple/, https://pkgs.dev.azure.com/COMPANY/PROJECT/_packaging/mi_r00397_shared/pypi/simple/
      User for pkgs.dev.azure.com: ERROR: Exception:
      Traceback (most recent call last):
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 216, in _main
          status = self.run(options, args)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/cli/req_command.py", line 182, in wrapper
          return func(self, options, args)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 325, in run
          reqs, check_supported_wheels=not options.target_dir
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/resolution/legacy/resolver.py", line 183, in resolve
          discovered_reqs.extend(self._resolve_one(requirement_set, req))
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/resolution/legacy/resolver.py", line 388, in _resolve_one
          abstract_dist = self._get_abstract_dist_for(req_to_install)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/resolution/legacy/resolver.py", line 339, in _get_abstract_dist_for
          self._populate_link(req)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/resolution/legacy/resolver.py", line 305, in _populate_link
          req.link = self._find_requirement_link(req)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/resolution/legacy/resolver.py", line 270, in _find_requirement_link
          best_candidate = self.finder.find_requirement(req, upgrade)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/index/package_finder.py", line 899, in find_requirement
          req.name, specifier=req.specifier, hashes=hashes,
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/index/package_finder.py", line 881, in find_best_candidate
          candidates = self.find_all_candidates(project_name)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/index/package_finder.py", line 826, in find_all_candidates
          project_url, link_evaluator=link_evaluator,
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/index/package_finder.py", line 790, in process_project_url
          html_page = self._link_collector.fetch_page(project_url)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/index/collector.py", line 643, in fetch_page
          return _get_html_page(location, session=self.session)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/index/collector.py", line 455, in _get_html_page
          resp = _get_html_response(url, session=session)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/index/collector.py", line 169, in _get_html_response
          "Cache-Control": "max-age=0",
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 543, in get
          return self.request('GET', url, **kwargs)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/network/session.py", line 421, in request
          return super(PipSession, self).request(method, url, *args, **kwargs)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 530, in request
          resp = self.send(prep, **send_kwargs)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 650, in send
          r = dispatch_hook('response', hooks, r, **kwargs)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_vendor/requests/hooks.py", line 31, in dispatch_hook
          _hook_data = hook(hook_data, **kwargs)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/network/auth.py", line 256, in handle_401
          username, password, save = self._prompt_for_password(parsed.netloc)
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/network/auth.py", line 226, in _prompt_for_password
          username = ask_input("User for {}: ".format(netloc))
        File "/home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip/_internal/utils/misc.py", line 259, in ask_input
          return input(message)
      EOFError: EOF when reading a line
      User for pkgs.dev.azure.com:
      ----------------------------------------
    ERROR: Command errored out with exit status 2: /home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/bin/python /home/thomas/.cache/pre-commit/repoa3dsqwwo/py_env-python3.6/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-che1xbcz/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple --extra-index-url https://pkgs.dev.azure.com/COMPANY/PROJECT/_packaging/mi_r00397_shared/pypi/simple/ -- 'setuptools>=41.0' setuptools-scm wheel Check the logs for full command output.

Check the log at /home/thomas/.cache/pre-commit/pre-commit.log
  

Комментарии:

1. pip запрашивает пароль, вам необходимо указать свои данные авторизации в дополнительном URL-адресе pypi