mkdocs-multirepo-plugin
mkdocs-multirepo-plugin copied to clipboard
No such file or directory: 'git' while using bitbucket
Does this plugin support imports from bitbucket?
@shanthisagar-dhanya-kumar-db, can you comment the Traceback so I can see the error messages?
59 asyncio_run(batch_import(repos))60 File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/mkdocs_multirepo_plugin/util.py", line 124, in asyncio_run61 asyncio.run(futures)62 File "/opt/rh/rh-python38/root/usr/lib64/python3.8/asyncio/runners.py", line 44, in run63 return loop.run_until_complete(main)64 File "/opt/rh/rh-python38/root/usr/lib64/python3.8/asyncio/base_events.py", line 616, in run_until_complete65 return future.result()66 File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/mkdocs_multirepo_plugin/structure.py", line 264, in batch_import67 repo = await import_async68 File "/opt/rh/rh-python38/root/usr/lib64/python3.8/asyncio/tasks.py", line 616, in _wait_for_one69 return f.result() # May raise f.exception().70 File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/mkdocs_multirepo_plugin/structure.py", line 245, in import_docs71 await self.sparse_clone([self.docs_dir, self.config])72 File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/mkdocs_multirepo_plugin/structure.py", line 123, in sparse_clone73 if git_supports_sparse_clone():74 File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/mkdocs_multirepo_plugin/util.py", line 89, in git_supports_sparse_clone75 git_v = git_version()76 File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/mkdocs_multirepo_plugin/util.py", line 75, in git_version77 output = subprocess.run(["git", "--version"], **extra_run_args)78 File "/opt/rh/rh-python38/root/usr/lib64/python3.8/subprocess.py", line 489, in run79 with Popen(*popenargs, **kwargs) as process:80 File "/opt/rh/rh-python38/root/usr/lib64/python3.8/subprocess.py", line 854, in init81 self._execute_child(args, executable, preexec_fn, close_fds,82 File "/opt/rh/rh-python38/root/usr/lib64/python3.8/subprocess.py", line 1702, in _execute_child83 raise child_exception_type(errno_num, err_msg, err_filename)84FileNotFoundError: [Errno 2] No such file or directory: 'git'85: 0%| | 0/2 [00:00<?, ?it/s]86Task exception was never retrieved87future: <Task finished name='Task-3' coro=<DocsRepo.import_docs() done, defined at /opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/mkdocs_multirepo_plugin/structure.py:233> exception=FileNotFoundError(2, 'No such file or directory')>88Traceback (most recent call last):89 File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/mkdocs_multirepo_plugin/structure.py", line 245, in import_docs90 await self.sparse_clone([self.docs_dir, self.config])91 File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/mkdocs_multirepo_plugin/structure.py", line 123, in sparse_clone92 if git_supports_sparse_clone():93 File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/mkdocs_multirepo_plugin/util.py", line 89, in git_supports_sparse_clone94 git_v = git_version()95 File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/mkdocs_multirepo_plugin/util.py", line 75, in git_version96 output = subprocess.run(["git", "--version"], **extra_run_args)97 File "/opt/rh/rh-python38/root/usr/lib64/python3.8/subprocess.py", line 489, in run98 with Popen(*popenargs, **kwargs) as process:99 File "/opt/rh/rh-python38/root/usr/lib64/python3.8/subprocess.py", line 854, in init100 self._execute_child(args, executable, preexec_fn, close_fds,101 File "/opt/rh/rh-python38/root/usr/lib64/python3.8/subprocess.py", line 1702, in _execute_child102 raise child_exception_type(errno_num, err_msg, err_filename)103FileNotFoundError: [Errno 2] No such file or directory: 'git'
And my main mkdocs.yaml looks like this
site_name: 'ADRs' site_description: 'Main documentation for Architecture Design Records'
repo_url: XXX
plugins:
- techdocs-core
- multirepo
nav:
- Index: 'index.md'
- CTO ADR: '!import XXXX/browse/CPDA-ADR/mkdocs.yaml'
- GCP CDA ADR: '!import XXXX/browse/GCDA-ADR/mkdocs.yaml'
The error above "No such file or directory: 'git'", does this mean that there needs to have git installed on that server?
@shanthisagar-dhanya-kumar-db, the plugin does require Git to be installed.
If the OS is Linux/MacOS, it assumes it's installed on the machine, otherwise it try's to find the git directory. I need to update the documentation to point to the Git requirement and output better error messages when cases like this come up.
I have now installed git and that specific issue got resolved. But I have another one
✅ Got GA ASR Docs: 0%| | 0/1 [00:00<?, ?it/s]38✅ Got GA ASR Docs: 100%|██████████| 1/1 [00:00<00:00, 2.78it/s] ✅ Got GA ASR Docs: 100%|██████████| 1/1 [00:00<00:00, 2.78it/s]
3940Traceback (most recent call last):41 File "/opt/rh/rh-python38/root/usr/local/bin/mkdocs", line 8, in
When I looked into the network share, it isn't creating the "temp_dir" under /tmp/backstage-l3mObl/. And also forgot to mention, we are using backstage-techdocs
Any thoughts on this?
@shanthisagar-dhanya-kumar-db, can you try to run the plugin without backstage and confirm that it works? I think backstage techdocs and the plugin might be interfering with each other possibly. You can also set cleanup=false
to confirm that the temp_dir
isn't being created.
Also the !import
statements don't look right, since it looks like a path and not a url.
CTO ADR: '!import XXXX/browse/CPDA-ADR/mkdocs.yaml'
The statement should look like this
nav:
- Home: 'index.md'
- MicroService: '!import {url}?branch={branch}?docs_dir={path}?multi_docs={True | False}?config={filename}.yml'
I tried setting cleanup=false but with no luck We are hosting the docs under bitbucket. Would this create issue?
Also the url I have specified is correct https://STASH_URL/projects/CPTCTO/repos/adr
Does the below mean that the plugin was able to successfully clone the git project
There were two issues basically
- The bitbucket url which I had given was wrong. Instead of scm url, i gave browse url
- I hadn't set the git credentials. ( it should have failed instead of saying Got XXXXX )
Now after setting the right credentials using the following git config --global user.name "xxx" git config --global user.email "xxx" git config --global user.password "xxx"
it still fails with the same error. Basically, it wasn't able to get the files from remote to local.
I can confirm that without backstage, it is working as expected.
With backstage techdocs-core plugin, it is failing.
But, this is very strange that it is failing to git clone
It is very strange. The way MkDocs plugins work it might be a case where backstage's plugins are interfering with this plugin. I've been busy but when I get a chance will try and look into it.
@jdoiro3 : Thanks for that. can we please do it sooner than later? Sorry for pushing this but in our organization there is this scenario that we have to use the multirepo plugin to demonstrate its goodness to the wider audience. I can help with some of the things if you want to nail down on a date and time so that I can respond to this thread
I'm on vacation until June 19th so it won't be until then. Feel free to fork the repo and try to figure out what's going on in this case. Also, buying me a beer (see link on README) increasing your chances I'll devote hours to the issue.